+ 2

Point out the error in the following program.

int main() { cout<<"Enter variable"; cin>>var sqrs = var *var cout<<"The square is"<<sqrs;

17th Jan 2017, 6:10 PM
Anand Kumar Maurya
Anand Kumar Maurya - avatar
4 ответов
+ 3
semicolons missing int var also missing int main() { int var,sqrs; cout<<"Enter variable"; cin>>var; sqrs = var *var; cout<<"The square is"<<sqrs; return 0; }
17th Jan 2017, 6:13 PM
Megatron
Megatron - avatar
+ 2
- Implicit language C++ - incomplete code ( at least a return statement and a closing bracket ) - no declaration of variables - ...
17th Jan 2017, 6:14 PM
visph
visph - avatar
+ 1
@Megatron: You forgot too a semi-colon ( sqrs = var *var ) ;)
17th Jan 2017, 8:31 PM
visph
visph - avatar
0
oops!!!! sorry.
17th Jan 2017, 8:52 PM
Megatron
Megatron - avatar