帮忙把下面两程序换成伪代码,谢谢

2025-05-13 13:00:36
推荐回答(1个)
回答1:

#include

using namespace std;

int main(int argc, char* argv[])
{
float a,b,c;
printf("%s"," Enter the weightInPKilograms:");
scanf("%f",&a);
printf("%s"," Enter the heightInMeters:");
scanf("%f",&b);
c = a / (b * b);
if (c<18.5
){
printf("Your BMI is %f, you are Underweight.\n",c);
}
else if (c<=24.9){
printf("Your BMI is %f, you are Normal.\n",c);
}
else if (c<=29.9){
printf("Your BMI is %f, you are Overweight.\n",c);
}
else
{
printf("Your BMI is %f, you are Obese.\n",c);
}

printf("%s"," Enter # of hours worked (-1 to end):");
scanf("%f",&a);
while (a!=-1){
printf("%s","Enter hourly rate of the worker ($00.00):");
scanf("%f",&b);
if(a<=40)
{
c=a*b;
}
else {
c=40*b+(a-40)*1.5*b;
}
printf("Salary is $%.2f\n\n\n",c);
printf("%s"," Enter # of hours worked (-1 to end):");
scanf("%f",&a);
}

return 0;
}