Question: This is a c++ program could you tell me why its running errors. #include #include #include using namespace std; float BMI(int height, int weight); }
This is a c++ program could you tell me why its running errors.
#include
using namespace std;
float BMI(int height, int weight); } int main() {
ofstream outfile("BMIchart.txt"); outfile << setw(8) << ("Weight"); for (int h = 60; h <= 80; h += 2) { outfile << setw(8) << h; } outfile << endl; for (int w = 75; w <= 225; w += 5) { outfile << setw(8) << w; for (int h = 60; h <= 80; h += 2) { float bmi = BMI(h, w); outfile << setw(8) << fixed << setprecision(1) << bmi;
float BMI(int height, int weight) { return 703 * (weight / (height * height); } int main() { ofstream outfile("BMIchart.txt"); outfile << setw(8) << ("Weight"); for (int h = 60; h < 80; h += 2) { outfile << setw(8) << h; } outfile << endl;
for (int w = 76; w <= 225; w + 5) { outfile << setw(8) << w; for (int h = 60; h <= 80; h + 2) { float bmi = BMI(h, w); outfile << setw(8) << fixed << setprecision(1) << bmi; { outfile << endl; }
outfile.close(); return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
