Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cmath>
- using namespace std;
- int main() {
- char gender;
- cin >> gender;
- double weight, height, basalMetabolicRate, coefficientActivity;
- cin >> weight >> height;
- int age;
- cin >> age;
- cin.ignore();
- string physicalActivity;
- getline(cin, physicalActivity);
- if (gender == 'm') {
- basalMetabolicRate = 66 + weight * 13.7 + height * 500 - 6.8 * age;
- }
- else {
- basalMetabolicRate = 655 + weight * 9.6 + height * 180 - 4.7 * age;
- }
- if (physicalActivity == "sedentary") {
- coefficientActivity = 1.2;
- }
- else if (physicalActivity == "lightly active") {
- coefficientActivity = 1.375;
- }
- else if (physicalActivity == "moderately active") {
- coefficientActivity = 1.55;
- }
- else {
- coefficientActivity = 1.725;
- }
- int calories = ceil(basalMetabolicRate * coefficientActivity);
- printf("To maintain your current weight you will need %i calories per day.\n", calories);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement