# problem

• 11-13-2003
makveli
problem
[code]
#include<iostream>
using namespace std;
int main()
{
int e;
cout<<"2.Subtraction"<<endl;
cout<<"3.Multiplication"<<endl;
cout<<"5.Devision"<<endl;
cin>>e;
if (e==1)

{
int g;
int b;
cout<<"Enter the two numbers you want to add "<<endl;
cin>>g;
cin>>b;
cin.get();
cin.get();
if (e==2)

{
int x;
int y;
cout<<"Welcome to subtraction"<<endl;
cout<<"Enter the two numbers you want to subtract "<<endl;
cin>>x;
cin>>y;
int sub;
sub = x - y;
cin.get();
cout<<x<<" subtract "<<y<<" is "<<sub<<endl;
cin.get();
if (e==4)

{
int z;
int q;
int w;
int k;
int f;
cout<<"Enter the five numbers you want to add "<<endl;
cin>>z;
cin>>q;
cin>>w;
cin>>k;
cin>>f;
ladd = z + q + w + k+ f;
cin.get();
cin.get();
if (e==5)

{
cout<<"Welcome to Devision"<<endl;
int t;
int g;
cout<<"Enter the two numbers you want to devide "<<endl;
cin>>t;
cin>>g;
int div;
div = t / g;
cin.get();
cout<<t<<" divided by "<<g<<" is "<<div<<endl;
cin.get();
if (e==3)

{
cout<<"Welcome to Multiplication"<<endl;
int i;
int h;
cout<<"Enter the two numbers you want to Multiply "<<endl;
cin>>i;
cin>>h;
int mul;
mul = i * h;
cin.get();
cout<<i<<" Multiplied by "<<h<<" is "<<mul<<endl;
cin.get();

}
return 0;
}
}
}
}
}
[code]
That is a calculator i made i want it so if you press 1 it goes to addition but if i press 2,3,4 it dosent go to the option the screen closes
• 11-13-2003
alphaoide
Re: problem
Code:

```#include<iostream> using namespace std; int main() {   int e;   cout<<"1.Addition"<<endl;   cout<<"2.Subtraction"<<endl;   cout<<"3.Multiplication"<<endl;   cout<<"4.Long Addition"<<endl;   cout<<"5.Devision"<<endl;   cin>>e;     if (e==1)   {       cout<<"Welcome to Addition"<<endl;       int g;       int b;       cout<<"Enter the two numbers you want to add "<<endl;       cin>>g;       cin>>b;       int add;       add = g + b;       cin.get();       cout<<g<<" plus "<<b<<" is "<<add<<endl;       cin.get();   }                      // you forgot the closing braces                  else if (e==2)  // use else-if instead of if, makes more sense   {         // the rest of the code```
Fix similar mistakes for the rest of the code
• 11-13-2003
Hunter2
You might want to edit your post to contain [ code] and [/ code] tags. It might make people more willing to help :o
• 11-13-2003
makveli
dont worry i found my mistakes