Hi,
I'm doing C++ with visual studios 2005 and recently did this program
#include <iostream>
int num1;
int num2;
int answer;
char operation;
int main()
{
cout << "Enter first number: ";
cin >> num1;
cout >> "Enter 1 (add) or 2 (subtract) or 3 (multiply) or 4 (divide): ";
cin >> operation;
cout << "Enter second number: ";
cin >> num2;
if (operation == 1)
{
answer = num1 + num2;
cout << "Sum: " << answer << endl;
}
else
if (operation == 2)
{
answer = num1 - num2;
cout << "Difference : " << answer << endl;
}
else
if (operation == 3)
{
answer = num1 * num2;
cout << "Product: " << answer << endl;
}
else
if (operation == 4)
{
answer = num1 / num2;
cout << "Quotient: " << answer << enl;
} //end if
system ("pause");
return 0;
} //end of main function
but when I compile it, it gives me the error message:
c:\documents and settings\ulamil a bubur\my documents\visua l studio 2005\projects\p rac3e1 solution\prac3e 1 project\prac3e1 .cpp(13) : error C2065: 'cout' : undeclared identifier
Please, help, I'm lost!!!!!!!!!
I'm doing C++ with visual studios 2005 and recently did this program
#include <iostream>
int num1;
int num2;
int answer;
char operation;
int main()
{
cout << "Enter first number: ";
cin >> num1;
cout >> "Enter 1 (add) or 2 (subtract) or 3 (multiply) or 4 (divide): ";
cin >> operation;
cout << "Enter second number: ";
cin >> num2;
if (operation == 1)
{
answer = num1 + num2;
cout << "Sum: " << answer << endl;
}
else
if (operation == 2)
{
answer = num1 - num2;
cout << "Difference : " << answer << endl;
}
else
if (operation == 3)
{
answer = num1 * num2;
cout << "Product: " << answer << endl;
}
else
if (operation == 4)
{
answer = num1 / num2;
cout << "Quotient: " << answer << enl;
} //end if
system ("pause");
return 0;
} //end of main function
but when I compile it, it gives me the error message:
c:\documents and settings\ulamil a bubur\my documents\visua l studio 2005\projects\p rac3e1 solution\prac3e 1 project\prac3e1 .cpp(13) : error C2065: 'cout' : undeclared identifier
Please, help, I'm lost!!!!!!!!!
Comment