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
|
#include <iostream>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstring>
//Body Weight
using namespace std;
double bmr(double);
double PhysAct(double, double, double);
void format(double);
void read(string, double, string, double, string, string, double, string, double);
double Digest(double, double);
double TotCal(double, double, double);
ifstream infile;
ofstream outfile;
int main()
{
const double weight = 155.0;
double inten, time, ounces, cal, BM, PA, TC, DG;
string food, oz, calories, intensity, minutes;
infile.open("C:\\Users\\Jacob\\Desktop\\weightdata.txt");
outfile.open("weightoutput.txt");
format(weight);
while (infile)
{
read(food, ounces, oz, cal, calories, intensity, inten, minutes, time);
BM = bmr(weight);
PA = PhysAct(inten, weight, time);
DG = Digest(BM, PA);
TC = TotCal(BM, PA, DG);
cout << food << "\t\t" << inten << "\t" << time << "\t\t" << BM << "\t\t" << PA << "\t\t" << DG << "\t\t" << TC << endl;
}
infile.close();
outfile.close();
return 0;
}
void format(double W)
{
cout << "Weight = " << W << endl;
cout << "Food\t\tIntensity\tMinutes\t\tBMR\t\tPhysical\tDigestion\tTotal Calories\n";
}
void read(string food, double ounces, string oz, double cal, string calories, string intensity, double inten, string minutes, double time)
{
infile >> food >> ounces >> oz >> cal >> calories >> intensity >> inten >> minutes >> time;
}
double bmr(double P)
{
double CalReq = 70 * pow((P/2.2),0.756);
return CalReq;
}
double PhysAct(double intens, double P, double minut)
{
double CalNeed = (0.0385 * intens * P * minut);
return CalNeed;
}
double Digest(double BM, double PA)
{
double digest;
digest = ((BM + PA) * .1);
return digest;
}
double TotCal(double BM, double PA, double DG)
{
double total;
total = BM + PA + DG;
return total;
}
|