INSTRUCTIONS:
Write a complete program that
declares an integer variable,
reads a value from the keyboard into that variable, and
writes to standard output the square of the variable's value.
Besides the number, nothing else should be written to standard output.
My answer :
#include <iostream>
using namespace std;
int main()
{
int name;
int result;
cin >> name >> endl;
result = (name*name);
cout << result << endl;
return 0;
}
The error I keep getting: CTest.cpp: In function 'int main()':
CTest.cpp:6: error: 'name' was not declared in this scope