+ 1

Can someone help me at this problem? I need it in c++ please.

You are cheering on your favorite team. After each play, if your team got over 10 yards further down the field, you stand up and give your friend a high five. If they don't move forward by at least a yard you stay quiet and say 'shh', and if they move forward 10 yards or less, you say 'Ra!' for every yard that they moved forward in that play. Task Given the number of yards that your team moved forward, output either 'High Five' (for over 10), 'shh' (for <1), or a string that has a 'Ra!' for every yard that they gained. Input Format An integer value that represents the number of yards gained or lost by your team. Output Format A string of the appropriate cheer. Sample Input 3 Sample Output Ra!Ra!Ra!

6th Feb 2022, 11:13 AM
Kaneki
Kaneki - avatar
5 Answers
+ 3
G'day Kaneki nice looking code! Have you made 100% sure that your output is the same as requested?? Hint: you haven't capitalised a word when you should. EDIT: I have been copy/pasting from the instructions into my code. I then copy the output strings into the bottom part of my code, then build cout statements around them. That way I'm guaranteed no spelling mistakes!
6th Feb 2022, 11:52 AM
HungryTradie
HungryTradie - avatar
+ 2
Kaneki Please show your attempts so we can tell where you are doing mistake. Read problem again and try to solve.
6th Feb 2022, 11:17 AM
AĶ¢J
AĶ¢J - avatar
+ 2
Here's my attempt: #include <iostream> using namespace std; int main() { int yards, a; cin >> yards; if(yards > 10) { cout << "High five"; } else if(yards < 1) { cout << "shh"; } else { for(a = 1; a <= yards; a++) { cout << "Ra!"; } } return 0; } Olny the third case is wrong.
6th Feb 2022, 11:25 AM
Kaneki
Kaneki - avatar
+ 2
Wow, thank you so much, HungryTradie. I just realised that I didn't capitalize "Five" from "High five". And I was blaming myself cause I wasn't prepared for problems like this.
6th Feb 2022, 12:02 PM
Kaneki
Kaneki - avatar
+ 1
Thanks for including the task! Can you add your attempted code as well?
6th Feb 2022, 11:17 AM
Slick
Slick - avatar