#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.
Is there anything wrong with this?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement