Ask coding questions

← Back to all posts
Why does this not work?
HiImAPerson (4)

I don't know why this doesn't work. I'm also a beginner, so please don't criticise any stupid mistakes.

Comments
hotnewtop
OldWizard209 (1603)

The problem is on line 24. Remove the colons from this:

  if(c == 1)
  ;{
    cout<<"Answer:\n";
    cout<<a*b<<endl;
    
 }else if(c == 2)
  ;{
    cout<<"Answer:\n";
    cout<<a/b<<endl;
  }
}

to this:

  if(c == 1){
    cout<<"Answer:\n";
    cout<<a*b<<endl;
    
 }else if(c == 2){
    cout<<"Answer:\n";
    cout<<a/b<<endl;
  }
}
HiImAPerson (4)

@HiImAPerson

but it doesn't work. Thanks for the advice though!