Need Help! Can't get the right percentages

#include <iostream>
#include <fstream>
#include <cstdlib>


using namespace std;

void ball_drawings()
{

int draw, even(0), seven(0), one_two_three(0); // Declare Variables
double percent_of_even, percent_of_seven, percent_123;
int maxpos = 1;
int ct = 1;
double status =1;

while(status==1)
{

// Input From User
cout << "How many lottery drawings will be simulated? =>";
cin >> draw; //number of lottery drawing
cout << ' ' << endl;
if(draw<1 || draw>10)
{
status=1;
cout<<"Number of lottery drawing must be greater than 0!\n";
}
else
{
status=0;
}
}


// Randomize numbers
srand(draw);

// Continue Drawing requested Amount

while (ct <= draw)
{
cout <<"Roll#"<<ct<<"\n";
for (int k = 1; k <= 5; k++)
{

cout << rand() % 10 + 1 << ' ';

if (rand() % 10 + 1 == 7)
{
seven++;
}
else
{
if (rand() % 10 + 1 == 2 || rand() % 10 + 1 == 4 || rand() % 10 + 1 == 6 || rand() % 10 + 1 == 8 || rand() % 10 + 1 == 10)
{
even++;
}
else
{
if (rand() % 10 + 1 == 1 && rand() % 10 + 1 == 2 && rand() % 10 + 1 == 3 && rand() % 10 + 1 == 4 && rand() % 10 + 1 == 5)
{
one_two_three++;
}
}
}
}
cout << ' ' << endl << "\n";

maxpos = ct;

ct++;

}


percent_of_even = (even / (draw * 4.0))*(100.0);
percent_of_seven = (seven / (draw * 3.0))*(100.0);
percent_123 = (one_two_three / (draw * 5.0))*(100.0);


// Output to Screen
cout << ' ' << endl;
cout << "Percentage of all even " << percent_of_even << "%" << endl;
cout << "Percentage of all sevens " << percent_of_seven << "%" << endl;
cout << "Percentage of all 1-2-3-4-5 order " << percent_123 << "%" << endl;
cout << ' ' << endl;

}
int main()
{
int loop=0;
do
{
ball_drawings();
cout<<"Another round for the lottery? Type 1 for yes, any other number for no";
cin>>loop;
}while(loop==1);

return(0);
}

this is the code I did

and this is the output I should get

Enter number of lottery drawings =>-4
Number of lottery drawings must be greater than 0!
Please re-enter number of lottery drawings =>5


Roll #1
5 9 6 4 10


Roll #2
10 9 7 3 2


Roll #3
6 5 3 1 4


Roll #4
5 6 2 4 3


Roll #5
10 1 9 8 4

Percentages of all even = 0%

Percentages of sevens = 20%

Percentages of all 1-2-3-4-5 order = 0%
Another round for the lottery? Type 1 for yes, any other number for no: 1
Enter number of lottery drawings =>3


Roll #1
4 10 6 9 7


Roll #2
1 5 8 9 3


Roll #3
2 10 7 6 3

Percentages of all even = 0%

Percentages of sevens = 66.6667%

Percentages of all 1-2-3-4-5 order = 0%

but unfortunately I can't please help me!!
The numbers that you are displaying, and the numbers that you are calculating stats for are different. Also, the formula for calculating your stats are mostly wrong.

Don't generate new numbers to check if they're even.
Don't generate new numbers to check if they're sevens.
Don't generate new numbers to check if they're in ascending order.

Rather, record the numbers when you generate them and use the recorded numbers to generate your statistics.
Topic archived. No new replies allowed.