Chef and Ice cream

can anybody please tell me the error in this? I was getting wrong answer but cant seem to find the error even after viewing the solution

#include
using namespace std;
void test_case(){
int n;
int coin5=0,coin10=0,coin15=0;
cin>>n;
while(n–){
int c;
cin>>c;
if(c==5){
coin5++;
}else if(c==10){
if(coin5==0){
cout<<“NO”<<endl;
return;
}else{
coin5–;
coin10++;
};
}
else if(c==15){
if(coin10==0){
if(coin5<2){
cout<<“NO”<<endl;
return;
}else{
coin5-=2;
coin15++;
};
}else{
coin10–;
coin15++;
};
};
};
cout<<“YES”<<endl;
}
int main()
{
int t;
cin>>t;
while(t–)
test_case();
return 0;
}

Bro format your code or give link to your submission. Use ``` at the start and the end of code for formatting.

Here’s the link to my submission
https://www.codechef.com/viewsolution/34326281

[quote=“akasharora506, post:1, topic:69440”]
coin10–;
[/quote]

it should be coin10- -; and coin5- -; @akasharora506 my bad. CodeBlocks gave me this error when I copied your code.

it is – only, check the link

in the code, it is coin5- - and coin10- -, please check

click here

19 line remove semicolon

and also return after giving every output

First you don’t have to put semicolon after else. Second, your code is not even working for sample TC. This is because, you are returning before taking all the input. You may see this https://www.codechef.com/viewsolution/34478713

but whats the use of taking further input if it fails at a certain input

If that input is not given then it will become input for next TC

oh right! thanks alot!