Sign in to follow this  

Is there anything wrong with this?

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";

case '1':
cout << "The if:\n\n";
cout << "if(condition) statement;\n";
cout << "else statement; \n";
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";
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this