C++ Basic Exercises

Congratulations, you have completed the basic part of our C++ Course.
Now let's practice.

Try with all your heart, with all your calm, effort and concentration, to do the exercises below.
Leave a comment with your solutions, ok?

C++ questions

01. Write a program that asks for the radius of a circle, and then displays the circle's perimeter and area.

02. Make a program that takes the radius of a sphere and calculates its volume.

03. Make a program that receives an integer, represented a value in years. Show how many days this time interval has, assuming a year has 365 days.

04. Make a program that receives two variables: the value of hours and minutes. Then convert everything to minutes and also to seconds.

05. Create a program that receives the temperature in degrees Celsius and converts it to Farenheit.

06. Do the opposite of the previous exercises.
Conversion between Celsius and Fahrenheit

07. Make a program that asks for the current year and your age, then displays your year of birth.

Percentage Exercises in C++

08. Make a program that calculates 12% of 2112

09. Make a program that receives a user value and calculates 12% of that total.

10. Make a program that receives a percentage value from the user, and calculates how much it represents from a second value that he typed.

11. Program software that receives two numbers, where the first must be less than the second.
It then calculates the percentage that the first represents from the second.
For example, if you entered 12 and 21, that means 12 represents 57.14% of 21

12. You have become a C ++ programmer, and now you are earning super good. But you will still have to pay taxes.
Create software that receives your salary and calculates the 7% income tax.

The output of your program should be gross salary (no rebate), the amount of tax you will pay and your net salary (after deducting IR).

13. Due to inflation, every year your salary should be adjusted based on it.
For example, if inflation was 2.5% then your salary should grow by the same amount so as not to lose value.
Create a C ++ program that asks for a person's salary, last year's inflation, and apply that inflation. Show previous salary, inflation increase, and new salary.

14. In the city of C ++ lland there is a tolerance of 15% of the speed limit so as not to be fined. Make a program that asks the user for the maximum speed of a road and calculates how fast the car can travel without being fined. Your code will be embedded in the car's GPS system to warn the speed limit the car must travel.
Solutions: Percentage in C++

Average exercises in C++

15. Create a program that asks the user for two grades, and returns their average.

16. Do the same as the previous exercise, but for 3 grades.

17. The MIT entrance exam weights are 3 for Mathematics, 2.5 for Physics, 2.5 for Chemistry, 1.0 for Foreign language and 1.0 for English. Create a system that asks for user grades and returns their average.

No comments:

Post a Comment