#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;

}

some of the errors that are coming up are:

error C2059: syntax error : '='
 error C2062: type 'int' unexpected
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'const char [8]' (or there is no acceptable conversion)
no operator found which takes a right-hand operand of type 'const char [10]' (or there is no acceptable conversion)

and i have an undeclared identifier in there somewhere i just can't find it

Recommended Answers

All 12 Replies

i fixed the unidentified identifier

wait no i did not; how do i identify 'resultAdd'?

resultsub
resultmult
all the 'results' are unidentified what do i do?

// result of the operation when addition is chosen
resultAdd == firstNo + secondNo;
cout<< "the sum of the numbers are ->/n";
cin >> "resultAdd";

Just a couple of little errors here:
1. you used == in place of the assignment operator =
2. the cin >> "resultAdd"; line is not needed

I believe this is what you intended:

// result of the operation when addition is chosen
resultAdd = firstNo + secondNo;
cout<< "the sum of the numbers are ->" << resultAdd << "/n";

Follow this structure and you should be able to fix the other problems

i still have these errors:
error C2065: 'resultAdd' : undeclared identifier
error C2065: 'result' : undeclared identifier
error C2065: 'resultSub' : undeclared identifier
error C2065: 'result' : undeclared identifier
error C2065: 'resultMult' : undeclared identifier
error C2065: 'result' : undeclared identifier
error C2065: 'resultDivi' : undeclared identifier
error C2065: 'seconNo' : undeclared identifier

wait scratch that it the errors are: error C2065: 'resultSub' : undeclared identifier
for all resultDivi, resultAdd, etc.

and i am still getting this error code:
error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'const char [9]' (or there is no acceptable conversion)

which has been there from the beginning

you have your code like this

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

// when it should like this
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

// or like this

int firstNo, secondNo, resultAdd, resultSub, resultMult, resultDivi;

thanks, i didn't notice i put in commas instead of semicolons, but i still have 1-3 errors which are:
syntax error : missing ';' before '<<'
no operator found which takes a right-hand operand of type 'const char [9]' (or there is no acceptable conversion)

i only have this now
no operator found which takes a right-hand operand of type 'const char [9]' (or there is no acceptable conversion)

Re-post your code (using the CODE tags) and we'll guide you in the right direction :)

its ok, after 5 hours of reading the text book, i got it to work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.