Trying to square a number that is input by a user, the number must be BETWEEN 0 and 10. If its not im asked to terminate program. What am i doing wrong and why wont my code compile?
#include <iostream>
usingnamespace std;
int main ()
{
double a;
cout << "Please enter decimal number that is greater than
0 but less than 10; " << endl;
cin >> a;
if ( a > 0 ) ( a < 10 )
{
cout << ( a * a ) << endl;
}
else
{
return 0;
}
"hw2.cpp" 33L, 329C written
[pejo9770@venus hw]$ g++ hw2.cpp
hw2.cpp: In function âint main()â:
hw2.cpp:18:2: error: expected â;â before â{â token
{