• Advertisement
Sign in to follow this  

Is there anything wrong with this?

This topic is 2689 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

#include <iostream>
using namespace std;

int main()
{
char choice;


cout << "Help on: \n";
cout << " 1. if\n";
cout << " 2. switch\n";
cout << "Choose one: ";
cin << choice;
cout << "\n";

switch(choice)
{
case '1':
cout << "The if:\n\n";
cout << "if(condition) statement;\n";
cout << "else statement; \n";
break;
case '2':
cout << "The switch:\n\n";
cout << "switch(expression) {\n";
cout << " case constant: \n";
cout << " statement sequence\n";
cout << " break;\n";
cout << " // ... \n";
cout << "}\n";
break;
default:
cout << "Selection not found.\n";
}

return 0;
}

It's just that I am getting so many errors that I can't even recognize what's wrong.

Share this post


Link to post
Share on other sites
Advertisement
Always solve the errors in order, starting with the first one the compiler gave.
It might give you 100 errors for just one character missing somewhere.
And never forget to post your errors, or at least the first 10 lines of them.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement