1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#include <iostream> int main() { int a{ 0 }; // hang doc int b{ 0 }; // hang ngang while (a < 5) { b = 1; a++; while (b <= a) { std::cout << b << " "; b++; } std::cout << std::endl; } system("pause"); return 0; }
1 2 3
In function 'int main()': Line 5: error: a function-definition is not allowed here before '{' token compilation terminated due to -Wfatal-errors.