0
C++ One test doesn't work, please help
the task is: if yard= 0 cout 'shh' if yard <=10 cout 'Ra!' (the same times as yards are) if yard>10 = cout 'High Five' One of the hidden test doen't work. Please help. #include <iostream> using namespace std; int main() { int yard; cin >> yard; if (yard >0&& yard <=10) for (int y= 1; y<=yard; y++){ cout << "Ra!" ; } if (yard >10) cout << "High Five"; if (yard==0) cout << "shh"; return 0; }
2 Réponses
+ 10
Code is correct.
Just add braces to first if case and inside those braces write that for loop code.
Like this:
if (yard >0&& yard <=10)
{
for (int y= 1; y<=yard; y++){
cout << "Ra!" ;
}
}
0
thank you very much!!