fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8. int Height, Weight, Age,Calories;
  9. double BMR;
  10. char Gender, ExerciseType;
  11.  
  12. cout.setf(ios::fixed);
  13. cout.setf(ios::showpoint);
  14. cout.precision(0);
  15.  
  16. cout << "Please provide your basic information" << endl; //Collecting of inputs for later phase of program.
  17. cout << "male or female (m or f)? ";
  18. cin >> Gender;
  19.  
  20. cout << "age in years? ";
  21. cin >> Age;
  22.  
  23. cout << "weight in pounds? ";
  24. cin >> Weight;
  25.  
  26. cout << "height in inches? ";
  27. cin >> Height;
  28.  
  29. cout << "How active are you?" << endl;
  30. cout << "s - sedentary" << endl;
  31. cout << "c - casual exerciser--exercise occasionally" << endl;
  32. cout << "a - active exerciser--exercise 3-4 days per week" << endl;
  33. cout << "d - devoted exerciser--exercise every day" <<endl;
  34. cout << "Enter the letter association with your activity level: ";
  35. cin >> ExerciseType;
  36.  
  37. cout << "What type of food do you want to eat? Please use _ between words to create a single word.";
  38. cin >> food;
  39.  
  40. cout << "How many calories per item? ";
  41. cin >> Calories;
  42.  
  43.  
  44. if (Age >= 65) // Statements that build only once conditions are met and fufills the program.
  45. {BMR = 1.375 * (655 + (4.3 * Weight) + (4.7 * Height) - (4.7 * Age));
  46. }
  47.  
  48. else if (Gender == 'f' || Gender == 'F')
  49. {BMR = 1.375 * (655 + (4.3 * Weight) + (4.7 * Height) - (4.7 * Age));
  50. }
  51.  
  52. else (Gender =='m' || Gender == 'M');
  53. {BMR = 1.375 * (66 + (6.3 * Weight) + (12.9 * Height) - (6.8 * Age));
  54. }
  55.  
  56. switch(ExerciseType) // Calculations for the differing case
  57. {
  58. case 's' :
  59. BMR = (BMR - (BMR * .05));
  60. cout << "BMR = " << BMR << endl;
  61. BMR = (BMR / Calories);
  62. cout << "number of " << food << " eaten = " << BMR;
  63. break;
  64. case 'c' :
  65. BMR = ((BMR * .30) + BMR);
  66. cout << "BMR = " << BMR << endl;
  67. BMR = (BMR / Calories);
  68. cout << "number of " << food << " eaten = " << BMR;
  69. break;
  70. case 'a' :
  71. BMR = ((BMR * .40) + BMR);
  72. cout << "BMR = " << BMR << endl;
  73. BMR = (BMR / Calories);
  74. cout << "number of " << food << " eaten = " << BMR;
  75. break;
  76. case 'd' :
  77. BMR = ((BMR * .50) + BMR);
  78. cout << "BMR = " << BMR << endl;
  79. BMR = (BMR / Calories);
  80. cout << "number of " << food << " eaten = " << BMR;
  81. default :
  82. cout << "Invalid Choice" << endl;
  83. return 0;
  84. }
  85.  
  86. }
  87.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:38:10: error: ‘food’ was not declared in this scope
   cin >> food;
          ^
stdout
Standard output is empty