-
going back
heres my code
Code:
#include<iostream>//cout i think
using namespace std;
int main()
{
int x;//the x
int y;//the y
int input;//another thing
cout<<"1. multiply\n";
cout<<"2. devide\n";
cout<<"3. addition\n";
cout<<"4. subtraction\n";
cout<<"please provide the number listed\n";
cin>> input;
switch ( input )
{
case 1:
cout<<"please provide 2 numbers to be multiplied\n";
cin>> x >> y ;
cin.ignore();
cout<<( x*y );
cin.get();
break;
case 2:
cout<<"please provide 2 numbers to be devided\n";
cin>> x >> y ;
cin.ignore();
cout<<( x/y );
cin.get();
break;
case 3:
cout<<"pls provide 2 numbers to be added\n";
cin>> x >> y ;
cin.ignore();
cout<<( x+y );
cin.get();
break;
case 4:
cout<<"pls provide 2 numbers to be subtracted\n";
cin>> x >> y ;
cin.ignore();
cout<<( x-y );
cin.get();
break;
}
}
but the the program ends how i make it so that i can go and choose something else
-
Just do a simple loop:
http://www.cprogramming.com/tutorial/lesson3.html
And put the prompt to repeat after the switch statement.
Also, I would put a default switch statement that says that input is not valid, ect.
*edit*
Also, a comment on your programming style.
Do not be afraid to use spaces! It makes it much more readable.
-
pls close i now know the answer