to make this shape by this code why i have to but [cout endi;] on this line and why not i but [return 0]; insted of cout endi; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

to make this shape by this code why i have to but [cout endi;] on this line and why not i but [return 0]; insted of cout endi;

#include <iostream> using namespace std; int main() { for(int i=1;i<=10;i++) { for(int j=1; j<=10; j++) { if (i==1||i==10) cout<<"*"; else if (j==1||j==10) cout<<"*"; else cout<<" "; }cout<<endl; } } ********** * * * * * * * * * * * * * * * * **********

22nd Aug 2019, 9:17 PM
Mahmoud Hamed
Mahmoud Hamed - avatar
1 Answer
0
"cout<<endl;" - output end of line. String return 0; terminates the main() function and returns 0 to the calling process. A non-zero value (usually 1) indicates abnormal termination. If there is no return expression, then the C++ compiler indirectly adds "return 0;" in the end of the main() function.
22nd Aug 2019, 11:14 PM
Solo
Solo - avatar