






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
C++ programs for various calculations and input/output operations. The programs include reading data from a file, writing data to a file, calculating the area of a rectangle and circle, and determining body fat percentage based on weight, wrist measurements, and hip measurement. The programs also include tax calculations and table printing.
Typology: Exams
1 / 12
This page cannot be seen from the preview
Don't miss anything!







#include
#include
fatpercentage = bodyfat * 100 / wight; cout << "bodyfatpercentage=" << fatpercentage << endl; } if (ch == 'w')// use if statement to check the condition { cout << "enter body weight " <<endl; cin >> wight; cout << "enter wrist " << endl; A1 = (wight * 1.082) + 94.42; A3 = wrist20.157; cout << "enter hip measurement " << endl; cin >> hip;// get from user cout << "enter forearn measurment " << endl; cin >> forearn;//get from user A4 = hip0.249; A5 = forearn*0.434; b = A1 + A2 - A3 - A4 + A5;// apply formula cout << "B=" << b << endl; bodyfat = wight - b; cout << "bodyfat=" << bodyfat << endl;// for output fatpercentage = bodyfat * 100 / wight; cout << "bodyfatpercentage=" << fatpercentage << endl; } if (ch == 'w')// use if statement to check the condition { cout << "enter body weight " <<endl; cin >> wight; cout << "enter wrist " << endl; A1 = (wight * 1.082) + 94.42; A2 = wrist / 4.15; b = A1 - A2; bodyfat = wight - b; cout << "body fat=" << bodyfat << endl; fatpercentage = bodyfat * 100 / wight; cout << "body fat percentage =" << fatpercentage << endl; } system("pause");// for pause the output return 0; }
#include
#include
#include
int main() { int arr[9]; int n; bool flag = true; for (int i = 0; i < 9; i++) { cin >> arr[i]; } cout << "Test Score\t\tCount\n"; for (int i = 0; i < 9; i++) { n = 1; flag = true; for (int j = i + 1; j < 9; j++) { if (arr[i] == arr[j]) { n++; } } for (int k = i - 1; k >= 0; k--) { if (arr[i] == arr[k]) { flag = false; } } if (flag == true) { cout << arr[i] << "\t\t\t" << n << "\n"; } } system("pause"); return 0; }