Lab 02 Arithmetics
Lab 02 Arithmetics
Arithmetic Operations
Cin in C++
2. Write a program that inputs one five-digit number. Separates the number into its
individual digits and prints the digits separated from one another by three spaces each.
For example, if the user types in 42139, the program should print
3. Write a program that reads in the radius of a circle and prints the circle’s diameter,
circumference and area. Use the constant value 3.14159 for π. Perform each of these
calculations inside the cout statement(s).
4. Using only the techniques you learned in this chapter, write a program that calculates the
squares and cubes of the numbers from 0 to 10 and uses tabs to print the following table
of values:
Create a BMI calculator application that reads the user’s weight in pounds and height in
inches (or, if you prefer, the user’s weight in kilograms and height in meters), then
calculates and displays the user’s body mass index. Also, the application should display
the following information from the Department of Health and Human Services/National
Institutes of Health so the user can evaluate his/her BMI:
6. A company wants to transmit data over the telephone, but they are
concerned that their phones may be tapped. All of their data is
transmitted as four-digit integers. They have asked you to write a
program that will encrypt their data so that it may be transmitted
more securely. Your program should read a four-digit integer and
encrypt it as follows: Replace each digit by the remainder after (the
sum of that digit plus 7) is divided by 10. Then, swap the first digit
with the third, and swap the second digit with the fourth. Then print
the encrypted integer. Write a separate program that inputs an
encrypted four-digit integer and decrypts it to form the original
number.
0.05/12 = 0.00417