0

Cheer Creator, keep failing test #3

I'm passing all the other tests except for test 3. Which is locked so I have no idea what's even going wrong. #include <iostream> using namespace std; int main() { int yard; int x; cin>>yard; if(yard >10) cout<<"High Five"; else if (yard < 1) cout<<"shh"; for (x=0; x < yard; x++) cout<<"Ra!"; return 0; } Please help. Thanks

26th Nov 2022, 8:28 PM
Houston Cisneros
Houston Cisneros - avatar
3 odpowiedzi
+ 2
Hey try this logic 👇 which is very simple #include <iostream> using namespace std; int main() { int n; string new_text, text = "Ra!"; cin >> n; if (n<1){ cout << "shh"; } else if(n>1 && n <=10){ for(int i=0;i<n;i++) { new_text+=text; } cout<<new_text<<endl; } else{ cout << "High Five"; } return 0; }
26th Nov 2022, 8:31 PM
Sâñtôsh
Sâñtôsh - avatar
+ 1
It worked. I'm assuming by comparing your code to mine. It had something to do with my "High Five" portion of the code. I'm not sure where mine went wrong though.
26th Nov 2022, 8:40 PM
Houston Cisneros
Houston Cisneros - avatar
+ 1
Houston Cisneros if you give input as 11 it prini High Five + 11 times Ra! So that's why it's all cases not passed
26th Nov 2022, 8:57 PM
Sâñtôsh
Sâñtôsh - avatar