You are on page 1of 1

Riphah International University Faculty of Computing

Programming Fundamentals Lab 08 Conditions


Learning Objective
1. Learn basics of C++
2. Learn how to use conditions in C++

Q1. Write a program that asks the user to enter the monthly costs for the following expenses
incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires and
maintenance. The program should then display the total monthly cost of these expenses and the total
annual cost of these expenses.

Q2. Write a program that converts the Celsius temperature to Fahrenheit temperatures. The formula
is F = (9/5) C + 32

F is the Fahrenheit temperature and C is the Celsius temperature.

Q3. Write a program that asks the user to enter a number of seconds.
1. There are 60 seconds in a minute. If the number of seconds entered by the user is greater
than or equal to 60, the program should display the number of minutes in that many seconds.
2. There are 3600 seconds in an hour. If the number of seconds entered by the user is greater than or
equal to 3600. The program should display the number of hours in that many seconds.
3. There are 85400 seconds in a day. If the number of seconds entered by the user is greater
than or equal to 86400 the program should display the number of days in that many seconds.

Q4. Write a program that asks the user to enter the number within the range of 1 through 10. Use
a switch statement to display the Roman numeral version of that number.

Input validation do not accept the number greater than 10 and less than 1.

Q5. The date June 10, 1960 is special because when we write the following format, the month
times the day equals the year.

6/10/60
Write a program which asks the user to enter the month, a day and the year in the two digit format.
The program should then determine that the whether the month times the day is equal to the year
or not. If so, then it should display a message that the date is magic.

Programming Fundamentals Riphah International University


Lab 8: Conditions Faculty of Computing

You might also like