אני מנסה להכניס שורה של תנאי (ברגע ששאר התנאים שהכנסתי לא מתקיימים)
זה הקוד איפה להכניס את ה- IF#include <iostream>
using namespace std;
const int MINAGE=11;
const int MAXAGE=120;
void main ()
{
// הגדרת משתנים
int age,height;
float weight,ratio;
//קבלת מידע
cout<< "This is a program that will fit you the right diet\n"<<endl;
cout<< "*\n";
cout<< "Please enter your age (in Years (11-120)) : \n";
cin>> age;
cout<< "Please enter your height (in Centimeter) : \n";
cin>> height;
cout<< "Please enter your weight (in Kilogram) : \n";
cin>> weight;
//חישוב היחס בין גובה למשקל
ratio=(height/weight);
//הכנסת תנאים
if ((age>=MINAGE)&&(age<=20)) // מטפל בגלאים 11-20
{
if ((ratio>=0.5)&&(ratio<2.0))
{
cout<<"Recommended meal for you is : C\n";
}
else if((ratio>2.0)&&(ratio<3.5))
{
cout<<"Recommended meal for you is : B\n";
}
else if ((ratio>3.5)&&(ratio<=5.0))
{
cout<<"Recommended meal for you is : A\n";
}
}
if ((age>=21)&&(age<=41)) // מטפל בגלאים 21-40
{
if ((ratio>=0.5)&&(ratio<2.0))
{
cout<<"Recommended meal for you is : C\n";
}
else if((ratio>2.0)&&(ratio<3.5))
{
cout<<"Recommended meal for you is : B\n";
}
else if ((ratio>3.5)&&(ratio<=5.0))
{
cout<<"Recommended meal for you is : B\n";
}
}
if ((age>=41)&&(age<=MAXAGE)) // מטפל בגלאים 41-120
{
if ((ratio>=0.5)&&(ratio<2.0))
{
cout<<"Recommended meal for you is : C\n";
}
else if((ratio>2.0)&&(ratio<3.5))
{
cout<<"Recommended meal for you is : A\n";
}
else if ((ratio>3.5)&&(ratio<=5.0))
{
cout<<"Recommended meal for you is : A\n";
}
}
cout<<"\nGoodbye\n"<<endl;
}