- #1
ihatecats2014
- 30
- 0
Homework Statement
#include <iostream>
using namespace std;
int main()
{
int firstNo;// first number is stored here
int secondNo,
int resultAdd,// variable for result when first number and second number are added
int resultSub,// variable for result when first number and second number are subtracted
int resultMult,// variable for result when first number and second number are multiplied
int resultDivi// variable for the reult when the first number and second number are divided
;
// asks the user to choose the first number
cout<< "Enter in the first Number -> /n";
cin >> "firstNo";
// asks the user for the second number
cout<< "Enter in the second Number -> ";
cin >> "secondNo";
cout<< "which operation would you like to choose?";
// result of the operation when addition is chosen
resultAdd == firstNo + secondNo;
cout<< "the sum of the numbers are ->/n";
cin >> "resultAdd"; // result of the operation when subtraction is chosen
resultSub = firstNo - secondNo;
cout<< "the difference of these numbers are ->/n";
cin >> "resultSub";
// result of the operation when multiplication is chosen
resultMult == firstNo * secondNo;
cout<< "the product of these numbers are ->/n";
cin >> "resultMult";
// result of the operation when division is chosen
resultDivi == firstNo/seconNo;
cout<< "the quotient of these two numbers are ->/n";
cin >> "resultDivi"
;if (secondNo == 0 )// restriction put upon operation so that denominator cannot be 0
firstNo/secondNo !==0;
cout<< "the quotient of these two numbers are undefined :(";
cout<<"/n";
return 0;
}
i don't know what i did wrong, but i guess i did a lot wrong, i just basically followed the template that my professor showed us, but the program he made just had one operation and that was addition.
it went like this:
Result = FirstNo + SecondNo;
cout<< "these numbers add up to ->";
cout<< Result;
so i figured i could just make more than one variable and define them with operations.
Last edited: