+ 7
what is output
#include<stdio.h> #include<conio.h> void main() { int i,j; clrscr(); for(i=0;i<=5;i++) { for(j=0;j<=5;j++) { printf("%d",i); } printf("\n"); } getch(); }
4 Answers
+ 12
000000
111111
222222
333333
444444
555555
Also you can try this code on playground and see the results.
Hope this helpsâșïžâșïž.
+ 4
You should use int main() instead of void main()
http://www.stroustrup.com/bs_faq2.html#void-main
+ 3
The simplest way is to use a stringstream:
#include<iostream> #include<string> #include<sstream> using namespace std; string itos(int i) // convert int to string { stringstream s; s << i; return s.str(); } int main() { int i = 127; string ss = itos(i); const char* p = ss.c_str(); cout << ss << " " << p << "\n"; }
0
is it even right?