can somebody help me with this....i'm creating a 4X4 sudoku program...with 8 auto-generating numbers and 8 user inputs...i used the random number function rand() but the numbers keep on repeating...the problem is i'm not allowed to use arrays...
int main()
{
int row1col1,row1col3,row2col2,row2col4,row3col1,row3col3,row4col2,row4col4;
int row1col2 = 0;
int row1col4 = 0;
int row2col1 = 0;
int row2col3 = 0;
int row3col2 = 0;
int row3col4 = 0;
int row4col1 = 0;
int row4col3 = 0;
row1col1=((rand()%4)+1);
row1col3=((rand()%4)+1);
row2col2=((rand()%4)+1);
row2col4=((rand()%4)+1);
row3col1=((rand()%4)+1);
row3col3=((rand()%4)+1);
row4col2=((rand()%4)+1);
row4col4=((rand()%4)+1);
char choice;
bool done = false;
do
{
displayMenu();
cin >> choice;
choice = toupper(choice);
switch (choice)
{
case '1' : enterdata1(row1col2);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '2' : enterdata2(row1col4);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '3' : enterdata3(row2col1);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '4' : enterdata4(row2col3);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '5' : enterdata5(row3col2);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '6' : enterdata6(row3col4);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '7' : enterdata7(row4col1);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '8' : enterdata8(row4col3);
displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case '9' : displaydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
case 'V': verifydata(row1col1,row1col2,row1col3,row1col4,row2col1,row2col2,row2col3,row2col4,row3col1,row3col2,row3col3,row3col4,row4col1,row4col2,row4col3,row4col4);
break;
system("pause");
case 'Q' : done = true;
break;
system("pause");
default : cout << "Invalid selection, try again!" << endl;
system("pause");
break;
}
} while (!done);
cout << "Good Bye!" << endl;
cout << endl;
return 0;
system("pause");
}
how do i use random number with a set of numbers without using array...is it possible..