Hi all,

Please see my code below. It compiles and runs beautifully in MSVC++ 6.0 (as a console program), but my teacher uses UNIX, and says it does not compile. Other students have said they've had luck using GCC (I am not familiar with that though). I know that MSVC is supposed to be ANSI compatible, but I think I am missing something, or maybe using functions in a way that isn't 'portable'. I will be thankful for any advice you can provide!
Thanks, Eric (code follows)

// CS501
// Eric
// 2/19/2002
// HW#4
// Exercise 17

// FirstOccurrence
// This program will show the (0 based) index of the first occurrence of the
// largest integer it finds in the input array.
// The input is the InputArray.
// The output is the index described bove.

#include "iostream.h"
#include "stdlib.h" // For random number generation.
#include "time.h" // For using time to get an integer to seed rand with.

#define LENGTH 15

int main(void)
{
int InputArray[LENGTH] = {0};

// Fill the array with random integers...
srand((unsigned)(time(NULL)));
for(int c = 0; c < LENGTH; c++)
InputArray[c] = (rand() % 10);

cout << "Input Sequence is: ";
for(int go = 0; go < LENGTH - 1; go++)
cout << InputArray[go] << ", ";
cout << InputArray[go];
cout << "\n\n";

int largest = InputArray[0];
int index = 0;

for(go = 1; go < LENGTH; go++)
{
if(InputArray[go] > largest)
{
largest = InputArray[go];
index = go;
}
}

cout << "The 0 based index of the first occurrence of " << largest << " is " << index;
cout << "\n\n";

return 0;
}




Competent novice programmer.