Ok so i post the code..which is working perfectly fine, then i go on with the question
/>/>
so here is the code and is working fine. it prints on the screen something like this ;
row number 5;
34, 45, 56, 67, 56,
row number 10;
76, 98, 12, 78, 77,
row number 11:
23, 56, 87, 99, 100
oh, so the problem is that i want to figure out a way that these numbers are extracted into the array tally: I cant tell from the beginning how long tally could be. all i know is that for every row that comes out, there gonna be five numbers, i cant also tell how many rows could come out. All are decided at runtime, if thats the term
/>/>
so at the end i should be able to do something like for(c=0;c<k+1;c++) cout<<tally;
can it be done? and if so can some good samaritan explain it to me? am only a beginner. Thanks
/>/>
#include <iostream>
using namespace std;
int ROW=44;
int LN [][5]={
/* 0*/ {37,13, 20, 84, 90},
/* 1*/ {26,83, 90, 72, 79},
/* 2 */{41,80, 39, 60, 40},
/* 3*/ {4, 46, 85, 61, 9 },
/* 4*/ {44,62, 74, 70, 49},
/* 5*/ {28,33, 72, 62, 88},
/* 6*/ {20,5, 6, 25, 71},
/* 7 */ {3, 9, 15, 84 ,34},
/*8*/{7, 52, 25, 83, 88},
/* 9*/{15,35, 67, 78, 6},
/*10*/ {53,38, 2, 10, 49},
/*11*/ {43,83, 17, 37, 15},
/*12*/ {90,36, 59, 3, 64},
/*13*/ {59,19, 28, 58, 76},
/*14*/ {51,81, 2, 8, 67},
/* 15/*/{64,72, 45, 86, 5},
/* 16*/{77,89, 38, 72, 45},
/*17*/{34,1, 74, 61, 89},
/*18*/{31,25, 75, 37, 84},
/*19*/ {23, 59, 57, 50, 77},
/*20*/ {79,90, 1, 23, 16},
/*21*/ {25,34, 22, 84, 7},
/*22*/ {70,46, 30, 37, 90},
/*23*/ {72,55, 75, 64, 71},
/*24*/ {90,8, 84, 36, 30},
/*25*/ {34,79, 81, 20, 12},
/*26*/ {82,56, 77, 49, 69},
/* 27*/ {42,30, 89, 84, 59},
/*28*/ {10,6, 68, 50, 87},
/*29*/ {28,7, 55, 62, 58},
/*30*/ {31,25, 86, 84, 87},
/*31*/ {36,66, 53, 3, 77},
/*32*/ {25,13, 72, 70, 47},
/*33*/{34, 77,80, 53, 33},
/*34*/ {86, 71, 23, 90, 8},
/*35*/{81, 45, 69, 38, 72},
/*36*/ {24, 61, 74, 41, 72},
/*37*/ {30, 27, 66, 43, 13},
/*38*/ {69, 20, 15, 64,59},
/*39*/ {14, 28, 59, 42, 67},
/*40*/ {2, 31, 88, 28, 55},
/*41*/{60, 73, 63, 19, 82},
/*42*/{67, 4, 42, 27, 29},
/*43*/ {16, 2, 51, 19, 74}
};
int r, c, k, Possiblenumbers1, Numberofpossiblenum=0;
int main ()
{
//1ST rolling, roll will be minus 2
for (r=0; r<ROW-2; r++)for (c=0;c<5;c++) /*locking a particular row, in this case starting from row 0*/
{
if(LN[r][c]==LN [ROW-1][0]
||LN[r][c]==LN [ROW-1][1]
||LN[r][c]==LN [ROW-1][2]
||LN[r][c]==LN [ROW-1][3]
||LN[r][c]==LN [ROW-1][4]) /*if at least a figure of row analysed equal to a figure of jumping board row*/
{r+=1, Numberofpossiblenum+=5;
cout<<endl<<"Row number:"<<r<<endl;
for (c=0;c<5;c++)
cout<<LN[r][c]<<", ";
}
}
cout<<endl<<endl<<"Number of possible numbers are"<<Numberofpossiblenum<<endl;
int tally[k]
return 0;
}
so here is the code and is working fine. it prints on the screen something like this ;
row number 5;
34, 45, 56, 67, 56,
row number 10;
76, 98, 12, 78, 77,
row number 11:
23, 56, 87, 99, 100
oh, so the problem is that i want to figure out a way that these numbers are extracted into the array tally: I cant tell from the beginning how long tally could be. all i know is that for every row that comes out, there gonna be five numbers, i cant also tell how many rows could come out. All are decided at runtime, if thats the term
so at the end i should be able to do something like for(c=0;c<k+1;c++) cout<<tally;
can it be done? and if so can some good samaritan explain it to me? am only a beginner. Thanks