Hello everybody here on the forum..am having a problem and i want somebody to help me out...am writing this program which is doing my head in...this is a part of the code...
{
if (LN[r][c]==LN [ROW-1][0]||LN [ROW-1][1]||LN [ROW-1][2]||LN [ROW-1][3]||LN [ROW-1][4])/*if at least a figure of row analysed equal to a figure of jumping board row*/
{r=+1,Numberofpossiblenum=+5;
for (c=0;c<5;c++)
{
cout<<"row number;"<<r<<endl<<"A possible number;"<<LN[r][c]<<endl<<"number of possible numbers are:\n"<<Numberofpossiblenum<<endl;}}
else
cout<<"for rolling one no values..."<<endl;
}
return 0;}
well the problem is that...i simply want the program to read the array going row by row column after column..comparing every single number to row 43...and if and only if a number of a particular row should be equal to that of any number of row 43...then the next row of that number should be printed on the screen..i think is should be a simple thing but my program is giving me wrong things..it works alright but the output is not what i want...i mean is wrong..so i think am making a mistake somewhere...SOMEBODY HELP ME OOOOUUUUUOUTTTT...thanks in advance :)
in if statement you are comparing only column 0 of LN. Remaining column comparing for true.
try this:
1 2 3 4 5 6
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*/
{
sorry FredFlinstone..what is the different between what you have written from what i have??? i think you just have it in a vertical order and i have it in a horizontal order but is the same...
may be am not understanding something..anyway..let me try it out your style...i will comeback to give results...thanks man :)
i tried it and the result is the same..now the whole thing is looping like mad....i mean although is looping and the resultings are moving very fast i still managed to read and i can see that..the result is wrong...may be i have to insert a break somewhere but i dont even know where...HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
In your following code you are missing to compare LN[ROW-1] column1, 2, 3, 4 with LN[r][c].
1 2 3 4 5
if (LN[r][c]==LN [ROW-1][0]
||LN [ROW-1][1]
||LN [ROW-1][2]
||LN [ROW-1][3]
||LN [ROW-1][4])/*if at least a figure of row analysed equal to a figure of jumping board row*/
I've added LN[r][c]== and I placed the test on multiple lines to highlight the difference.
The possible cause of the infinite loop would depend on the presence of r = +1 inside the loop for (r = 0; ...
I've cleared and the program stops.
i figured it out...the problem was a very simple one...r=+1 is a wrong syntax,,,it should have been r+=1, and the same thing for Numberofpossiblenum+=5..anyway thanks for your effort ;) everything worked perfectly the moment i changed that ..thanks again anyways