1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
#include <iostream>
#include <string>
#include <fstream>
#include<cmath>
using namespace std;
int totalCaloriesBurned (double);
int main()
{
ifstream inputFile;
int exercise2;
int workout;
string exercise;
cout << "How was your workout today Martha? Enter 1 for Excellent,\n2 for okay and 3 for bad. ";
cin >> workout;
cout << endl;
if (workout == 1)
cout << "Excellent, lets get to recording the workout!" << endl;
else if (workout == 2)
cout << "Only Okay, maybe work harder next time, lets get to recording your workout!" << endl;
else if (workout == 3)
cout << "Having a bad day, sorry to hear that, lets get to recording your workout!" << endl;
else
cout << "Please enter a number between 1 and 3" << endl;
cout << endl;
cout << endl;
cout << "Please select from the following list\n";
cout << "of exercises:" << endl;
cout << endl;
inputFile.open("E:\\Final Project\\exercise.txt");
inputFile >> exercise;
cout << "1) " << exercise << endl;
inputFile >> exercise;
cout << "2) " << exercise << endl;
inputFile >> exercise;
cout << "3) " << exercise << endl;
inputFile >> exercise;
cout << "4) " << exercise << endl;
inputFile >> exercise;
cout << "5) " << exercise << endl;
inputFile >> exercise;
cout << "6) " << exercise << endl;
inputFile >> exercise;
cout << endl;
inputFile.close();
int minutes, day1, day2, day3, day4, day5, day;
double caloriesBurned;
double calories1 = 4, calories2 = 7, calories3 = 8, calories4 = 2, calories5 = 8, calories6 = 9;;
for (day = 0; day <= 5; day++)
{
cout << "enter your first days exercise: " << endl;
cin >> day;
cout << "From the list above please select\n";
cout << "your workout number from 1-6: ";
cin >> exercise2;
cout << endl;
while (exercise2 == 1)
{
cout << "For how many minutes did you exercise? ";
cin >> minutes;
cout << endl;
caloriesBurned = minutes * calories1;
cout << "You burned " << caloriesBurned << " during your workout today\n";
cout << "Great Job! :-)" << endl;
cout << endl;
break;
}
while (exercise2 == 2)
{
cout << "For how many minutes did you exercise? ";
cin >> minutes;
cout << endl;
caloriesBurned = minutes * calories2;
cout << "You burned " << caloriesBurned << " during your workout today\n";
cout << "Great Job! :-)" << endl;
cout << endl;
break;
}
while (exercise2 == 3)
{
cout << "For how many minutes did you exercise? ";
cin >> minutes;
cout << endl;
caloriesBurned = minutes * calories3;
cout << "You burned " << caloriesBurned << " during your workout today\n";
cout << "Great Job! :-)" << endl;
cout << endl;
break;
}
while (exercise2 == 4)
{
cout << "For how many minutes did you exercise? ";
cin >> minutes;
cout << endl;
caloriesBurned = minutes * calories4;
cout << "You burned " << caloriesBurned << " during your workout today\n";
cout << "Great Job! :-)" << endl;
cout << endl;
break;
}
while (exercise2 == 5)
{
cout << "For how many minutes did you exercise? ";
cin >> minutes;
cout << endl;
caloriesBurned = minutes * calories5;
cout << "You burned " << caloriesBurned << " during your workout today\n";
cout << "Great Job! :-)" << endl;
cout << endl;
break;
}
while (exercise2 == 6)
{
cout << "For how many minutes did you exercise? ";
cin >> minutes;
cout << endl;
caloriesBurned = minutes * calories6;
cout << "You burned " << caloriesBurned << " during your workout today\n";
cout << "Great Job! :-)" << endl;
cout << endl;
break;
}
}
cout << "Your total calories burned: ";
cout << "during your workouts is: " << totalCaloriesBurned << endl;
system("pause");
return 0;
}
double totalCalriesBurned(double day1, double day2, double day3, double day4, double day5);
{
int result;
result = day1 + day2 + day3 + day4 + day5;
return result;
}[code][/code
|