Im having an issue, this program doesnt compile at all, idk what i did wrong, please need assistance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;

int biggestEntry(int a[][3],int rowcap, int colcap){
        int ans=a[0][0];
        for(int r=0; r<=rowcap-1; r++){
        for(int c=0; c<=colcap-1; c++)
        if(a[r][c]>ans) ans=a[r][c];
        }
        return rowcap;
        }

int main ()
{
        //biggestEntry:
        //cout << "Testing biggestEntry: ";
        int arr1 [2][3] = {{1, 8, 3}, {4, 7, 3}};
        //cout << biggestEntry (arr1, 2, 3) << endl; //prints: 8,
return 0;
}
Compiles just fine for me.
it compiles but there isnt any answer...it just like exits back to the server
well that's because it doesn't do anything.

What is it supposed to do?

EDIT: Also, read this:

http://cplusplus.com/forum/articles/40071/#msg218019
Last edited on
suppose find the biggest entry in the array which is 8
ok i read that and the issue here is, it doesnt run like how i want it to. I am suppose to get the biggest entry in the array however my code does not do what i want.
It looks like you have everything commented out. The computer doesn't run code when it's in comments.

Take a look at your main function. When you remove the commented lines you have this:

1
2
3
4
5
6
int main ()
{
    int arr1 [2][3] = {{1, 8, 3}, {4, 7, 3}};

    return 0;
}


All it's doing is creating an array, then exiting. If you want it to do more you have to tell it to do more.


Try uncommenting line 18. That looks like it is calling the function to find the highest value in the array.
oh wow im stupid lol..that was all i needed, damn i hate making errors like that, thanks Disch your help was greatly appreciated
Topic archived. No new replies allowed.