VisaManiac
Technical User
I apologize for bringing in such a simple question, but I just enrolled in a beginners C++ class, and here's one of our questions...what am I doing wrong? It won't resolve.
#include <iostream>
using namespace std;
int main()
{
int a;
int x;
cout << "Please enter a number between 1 through 4";
cin >> a;
switch(a)
{
case a = '1':
cout << x += 5 << endl;
break;
case a = '2':
cout << x += 10 << endl;
break;
case a = '3':
cout << x += 16 << endl;
break;
case a = '4':
cout << x += 34 << endl;
break;
default:
cout << "You did not enter a number of 1 through 4." << endl;
}
system("PAUSE");
return 0;
}
A little guidance would be greatly appreciated!
#include <iostream>
using namespace std;
int main()
{
int a;
int x;
cout << "Please enter a number between 1 through 4";
cin >> a;
switch(a)
{
case a = '1':
cout << x += 5 << endl;
break;
case a = '2':
cout << x += 10 << endl;
break;
case a = '3':
cout << x += 16 << endl;
break;
case a = '4':
cout << x += 34 << endl;
break;
default:
cout << "You did not enter a number of 1 through 4." << endl;
}
system("PAUSE");
return 0;
}
A little guidance would be greatly appreciated!