Skip to content

CS 1415 - Lab #2

Objective: 

Program with structures

Preparation: 

Review Chapter 11 from Starting Out with C++ by Gaddis.

Programming: 

  1. Place your code in a file named LlllFfffLab02.cpp where Llll is the first four letters of your last name and Ffff is the first four letters of your first name.
  2. Define a structure to represent a rational number.
  3. Write a function definition and prototype for a function that gets a rational number from the user and returns it to the program.
  4. Write a function definition and prototype for a function that receives a rational number and returns an equivalent rational number reduced to lowest terms.
  5. Write a function definition and prototype for a function that receives and displays a rational number.
  6. Write a driver program (main function) that uses the functions described above to get a rational number from the user then displays it in lowest terms.
  7. Verify the program works correctly.
  8. Submit your source code file to ude.wons@nosneros.htrag. Due at 8:00 am on 14 January.