Thanks anyone who help me with this :D in advance.
As I said in my description, the program generates TwinPrimes, from an initial range to a final range. The first output gets clear out, and the remaining one its the ones showing on the screen.
Example: initial Number 3
final Number 10000
At pair generation ( 6551 , 6553 ) When pairs get to 6500 and up. (If I'm not mistaken)
( 3 , 5 ) <=== This one already disappears on the screen , meaning that the screen only can hold 300 lines at same time. And repetitive will be clearing the screen and adding remaining pairs until the iteration gets at 10,000. (does the same with final number 6500 and up)
( 5 , 7 )
( 11 , 13 )
( 17 , 19 )
( 29 , 31 )
( 41 , 43 )
( 59 , 61 )
( 71 , 73 )
( ... , ... ) <==== Simulates the the whole generation of twin primes in between, just to demonstrate my point, and not take too much space on this post.
( 6359 , 6361 )
( 6449 , 6451 )
( 6551 , 6553 ) |
What to do, so the screen can get more than 300 lines at same time, without clearing out the first outputs of twin primes on the screen?
for the ease of the helper, I'll be posting the function definition that generates this outputs (twin primes) and prints them on the screen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
// Verifica cuales son los pares de primos gémelos en el rango dado y los imprime.
void imprimePrimosGemelos(long &numero1, long &numero2, ofstream& salida)
{
long j = numero1 + 2;
long gemelos = 0;
Primos unPrimo;
for(long i = numero1; i < numero2; j = i + 2)
{
if(unPrimo.primo(j) == true)
{
cout << "\n\n\t ( " << i << " , " << j << " )";
salida << "\n\n\t ( " << i << " , " << j << " )";
gemelos++;
}
else
{
while (unPrimo.primo(j) == false)
{
j+=2;
}
}
i = j;
}
cout << "\n\n\t Total de nu'meros primos gemelos: " << gemelos
<< "\n\n\n\t";
salida << "\n\n\t Total de nu'meros primos gemelos: " << gemelos;
system("pause");
system("cls");
}
| |
Sorry if in on Spanish, since I'm from Latin America, my programs are mostly on my native language to the ease of the context for me.
Well any clues?
Thank you very much! Any help would be accepted
PSPMAN90