0
HELP!!!55+55=55????
I wrote this really simple code, If something is very obviously wrong, pardon me, But this isnt Working!!! I plug in 55+55 and it throws 55 //simple calculator #include <iostream> using namespace std; int main() { int sol; // declares var cin>>sol; //user inputs eqaution into sol cout<< "="<<sol; // c++ calculates the value of sol and outputs it /* it seems to work without the cin (Manual Input)*/ return 0; }
2 RĂ©ponses
0
you can't enter an equation in just 1 input and stores it in a variable..try declare two int variables that store user's input and then cout first int variable + second int variable ..
0
#include<iostream>
using namespace std;
int main()
{
int n1,n2;
cin>>n1>>n2; // input n1 press space then n2 and press enter.
cout<<"Total is : "<<n1+n2<<endl;
return 0;
}