Keep getting these errors:
calories1.cpp: In function ‘int main()’:
calories1.cpp:72: error: invalid lvalue in assignment
calories1.cpp:76: error: expected primary-expression before ‘else’
calories1.cpp:76: error: expected `;' before ‘else’
calories1.cpp:80: error: invalid lvalue in assignment
calories1.cpp:84: error: expected primary-expression before ‘else’
calories1.cpp:84: error: expected `;' before ‘else’
calories1.cpp:87: error: expected `}' at end of input
calories1.cpp:87: error: expected `}' at end of input
calories1.cpp:87: error: expected `}' at end of input
calories1.cpp:87: error: expected `}' at end of input
whats wrong with my code?
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 160 161 162 163 164 165 166 167 168 169 170 171
|
#include <iostream>
using namespace std;
void male_function ();
void female_function ();
void level1_function ();
void level2_function ();
int main ()
{
int gender;
cout << "Welcome to Calorie Calculator!!\n\n";
cout << "This program will calculate your caloric Intake!" << endl;
cout << "\n\n" << "What is your gender? (1 for female, and 2 for male): ";
cin >> gender;
while (gender == 1 || gender == 2)
{
cout << "\n\n" << "I'm sorry, you entered something other than 1 or 2." << endl;
cout << "\n\n" << "Please indicate if you are male or female." << endl;
cout << "by entering 1 for female or 2 for male: ";
cin >> gender;
}
if (gender == 1)
{
female_function ();
}
else
{
male_function ();
}
//get weight
cout << "how much do you weigh in pounds? ";
int weight;
cin >> weight;
while (weight < 50 || weight > 500)
{
cout << "\n\n";
cout << "Please enter a weight more than 50lbs and below 500lbs" << endl;
cin >> weight;
}
//get activity level
int Alevel;
cin>> Alevel;
while (Alevel == 1 || Alevel == 2)
{
cout << "What is your activity level?\n\n";
cout << "Select 1 for Low activity, Select 2 for Moderate Activity.";
cin>> Alevel;
if (Alevel == 1)
{
level1_function ();
}
else
{
level2_function ();
}
//get caloric total
{
int calories;
cin>> calories;
if (gender == 1 || Alevel = 1)
calories = (10 * weight);
{
cout<<"Your caloric intake is.. " <<calories<< "." <<endl;
else (Alevel = 2) {
calories = (12 * weight);
cout<<"Your caloric intake is.. " <<calories<< "." <<endl;
}
if (gender == 2 || Alevel = 1)
calories = (13 * weight);
{
cout<<"Your caloric intake is.. " <<calories<< "." <<endl;
} else (Alevel = 2) {
calories = (15 * weight);
cout<<"Your caloric intake is.. " <<calories<< "." <<endl;
}
|