### Changing code syntax

I have this small program that simulates dice rolls using random numbers. It does 1 million rolls and outputs the results for 1, 10, 100....., 1000000. The way my code is structured right, the program starts by outputting the results for 1 roll, then does 9 other rolls and outputs the results again. I would like to make it so all the rolls are done before outputting anything, because right now I'm basically stopping every loop to check if a condition is met or not and I believe this is somewhat unrecommended. How could I make it so the output code is outside the random loop ?

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687`` ``````int Nb; int Face; loat Fq1 = 0; float Fq2 = 0; float Fq3 = 0; float Fq4 = 0; float Fq5 = 0; float Fq6 = 0; int Mod; srand((unsigned int)time(NULL)); for(Nb = 1; Nb >= 1 && Nb <= 1000000; Nb++) { // Randomizing numbers Face = rand() % 6 + 1; switch(Face) { case 1: Fq1++; break; case 2: Fq2++; break; case 3: Fq3++; break; case 4: Fq4++; break; case 5: Fq5++; break; case 6: Fq6++; break; } // Averages float Pour1 = Fq1 * 100 / Nb; float Pour2 = Fq2 * 100 / Nb; float Pour3 = Fq3 * 100 / Nb; float Pour4 = Fq4 * 100 / Nb; float Pour5 = Fq5 * 100 / Nb; float Pour6 = Fq6 * 100 / Nb; // Output Mod = 1; if(Nb % Mod == 0) { gotoxy(0,1); cout << "Essaie avec " << Nb << " lancer(s):"; cout << endl << endl; cout << setw(L1) << right << "Face"; cout << setw(L2) << right << "Fr\x82quence"; cout << setw(L3) << right << "Pourcentage"; cout << endl; cout << setw(L1) << right << "1"; cout << fixed << setprecision(0) << setw(L2) << right << Fq1; cout << fixed << setprecision(2) << setw(L3) << right << Pour1 << "%"; cout << endl; cout << setw(L1) << right << "2"; cout << fixed << setprecision(0) << setw(L2) << right << Fq2; cout << fixed << setprecision(2) << setw(L3) << right << Pour2 << "%"; cout << endl; cout << setw(L1) << right << "3"; cout << fixed << setprecision(0) << setw(L2) << right << Fq3; cout << fixed << setprecision(2) << setw(L3) << right << Pour3 << "%"; cout << endl; cout << setw(L1) << right << "4"; cout << fixed << setprecision(0) << setw(L2) << right << Fq4; cout << fixed << setprecision(2) << setw(L3) << right << Pour4 << "%"; cout << endl; cout << setw(L1) << right << "5"; cout << fixed << setprecision(0) << setw(L2) << right << Fq5; cout << fixed << setprecision(2) << setw(L3) << right << Pour5 << "%"; cout << endl; cout << setw(L1) << right << "6"; cout << fixed << setprecision(0) << setw(L2) << right << Fq6; cout << fixed << setprecision(2) << setw(L3) << right << Pour6 << "%"; cout << endl << endl; } }``````
If you don't want your output code inside the loop, then you just put it outside.XD
The whole would like this:
Start with a for-loop doing 1000000 rolls. After it is done, take average and output.
I might be overcomplicating things here in my head, but I just don't see how I could easily make the program output the results for 1, 10, 100, etc.. up to 1 million.

The differents output screens are to be always at the same position, making the illusion the numbers are adding up (with a _getch() in between).

I'll try to think in a more simple way.
 I just don't see how I could easily make the program output the results for 1, 10, 100, etc.. up to 1 million.
 ``12345678`` `````` //Mod = 1; // do this before the start of the for loop instead if (Nb % Mod == 0) { Mod *= 10; gotoxy(1,1); cout << "Essaie avec " << Nb << " lancer(s):"; // etc. ``````