I am having a hard time figuring out what's wrong with my code. Here is my code and when i run it it displays the same word all over again even though i entered different numbers. Please help me, thanks a lot.
int main()
{
const int size = 4;
double arr[size];
int i;
cout << "Input numbers: ";
for(i=0;i<4;i++)
{
cin >> arr[i];
}
for(i=0;i<size;i++)
{
if(0<=arr[i]<=5)
{
cout << "HEY" << endl;
}
else if(0>arr[i])
{
cout << "Hello" << endl;
}
else if(10<arr[i]<20)
{
cout << "Haha" << endl;
}
else
{
cout << "Hoho";
}
}
cin.ignore(); cin.ignore();
return 0;
}
Aucun commentaire:
Enregistrer un commentaire