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

May 2, 2011 at 2:46am
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; Python)
        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;
}
May 2, 2011 at 2:56am
Compiles just fine for me.
May 2, 2011 at 3:01am
it compiles but there isnt any answer...it just like exits back to the server
May 2, 2011 at 3:02am
well that's because it doesn't do anything.

What is it supposed to do?

EDIT: Also, read this:

http://Python/forum/articles/40071/#msg218019
Last edited on May 2, 2011 at 3:03am
May 2, 2011 at 3:15am
suppose find the biggest entry in the array which is 8
May 2, 2011 at 3:16am
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.
May 2, 2011 at 3:53am
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.
May 2, 2011 at 3:57am
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.