I have a file attached with this 6 rows of information
const int MAX_VAL = 53;
const int NUM_NUMS = 6;
const int MAX_ROWS =5
void quickPick(int row[NUM_NUMS];
void displayTicket( int ticket[MAX_ROWS][NUM_NUMS], long long ticketNum );
void sortRow( int row[NUM_NUMS] );
so i need help in these two areas, sortRow and displayTicket as you see,
void sortRow( int row[NUM_NUMS] )
this function will take the given integer array and sort the contents in ascending order.
void displayTicket( int ticket[MAX_ROWS][NUM_NUMS],
long long ticketNum )
this function will display a quick pick ticket using the given two-dimensional array. This will only display the number of rows passed to it by the ticketNum parameter.
and i know i will assign a function to getDraws, but i'm focusing on those first two problems first, thank you :)
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include "qpick.h"
using namespace std;
void quickPick(int row[NUM_NUMS])
{
bool used[MAX_VAL + 1];
int pick;
for (int i = 1; i <= MAX_VAL; i++)
used[i] = false;
for (int i = 0; i < NUM_NUMS; i++)
{
do
pick = rand() % MAX_VAL + 1;
while (used[pick]);
row[i] = pick;
used[pick] = true;
}
}
void sortRow(int row[NUM_NUMS])
{
}
void displayTicket(int ticket[MAX_ROWS][NUM_NUMS],
long long ticketNum)
{
}
int main()
{
int ticket[MAX_ROWS][NUM_NUMS];
unsigned seed = time(0);
int numDraws;
long long int ticketNum;
srand( seed );
int a;
cin >> "a";
numDraws = getDraws(a);
if (numDraws == 0)
{
cout << "Canceling Transation\n\n";
return 0;
}
ticketNum = seed * 10LL + numDraws;
for (int i = 0; i < numDraws; i++)
{
quickPick(ticket[i]);
sortRow(ticket[i]);
}
displayTicket(ticket, ticketNum);
return 0;
}
|