### "Magic Matrix" Calculations issue

I am attempting to create a program which calculates the product of 4 vertical values in the matrix. The numbers are supposed to be randomly generated and the size of the matrix is given through the command window.

However I seem to have either not pointed my matrix through all of my functions correctly, or my logic is off somewhere as I keep getting this output regardless of the size of matrix I put in:

"the location of the highest horizontal line product is: 5 0 and is the number: 0

The overall max value is 4196352 at the above coordinates."

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118`` ``````using namespace::std; //srand(time(0)); int h_line(int**, int, int); int v_line(int, int,int); int diagnol_left(int,int,int); int diagnol_right(int,int,int); int zigzag(int,int,int); int get_random_number(); //compares the value of the privious call to a function value (h_line and v_line ect...) int comparer(int max,int checker){ if(checker>=max){ max=checker;} else{ max=max;} return (max);} //Will eventually compare all of the different shape products of their respective functions int comparer_function(int **argv, int max ,int checker, int rows, int cols){ max=comparer(max, checker); checker=h_line(argv, rows, cols); max=comparer(max, checker); /*checker=v_line(**argv, rows, cols); max=comparer(max, checker); checker=diagnol_left(**argv,rows,cols); max=comparer(max, checker); checker=diagnol_right(**argv,rows, cols); max=comparer(max, checker); checker=zigzag(**argv,rows, cols); max=comparer(max, checker);*/ cout<=max){ max=checker; ihelp=i; jhelp=j;} else { checker=checker;}}} cout<<"The location of the highest horizontal line product is: "< 100 || *argv[1] < 1 || *argv[1] > 100) { cout<<"Please give a value between 1 and 100 that is not a decimal value for the rows and columns of the array, restart the program with the correct inputs from the command line, and remember even if you do it wrong your mother still loves you."<

I am going to assume I have done something absolutely idiotic, but I can't seem to find the mistake.
The matrix is never allocated.

Please beautify your code. Looking at it is like stabbing my eyes with needles.
Last edited on
Ahh brilliant of me that was.

Yes I will make it pretty once I get it done, my ideas had gone everywhere and it took over the code.

Thanks.
Topic archived. No new replies allowed.