problem

Hi all.
While i was reading this tutorial i found some problems.It was in the capter with the arrays.I read it all and got to the last sourse code.I compiled it and when i tried to run it the compiler told me that the code is not ready.
But it didn't showed me any mistakes

Here's the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// arrays as parameters
#include <iostream>
using namespace std;

void printarray (int arg[], int length) {
  for (int n=0; n<length; n++)
    cout << arg[n] << " ";
  cout << "\n";
}

int main ()
{
  int firstarray[] = {5, 10, 15};
  int secondarray[] = {2, 4, 6, 8, 10};
  printarray (firstarray,3);
  printarray (secondarray,5);
  return 0;
}
The code works.

the compiler told me that the code is not ready.

Just write exactly what the compiler 'says', and what compiler are you using.
Then you must have some problem with your compiler. I've run your program quite well through my CodeBlocks.

You can try this to test whether your compiler is ready for C++. I just read this a few minutes ago, hope this will help.

1
2
3
4
5
6
7
8
9
#include <iostream>
using namespace std;
template <class T>
bool ansisupported (T x) { return true; }

int main() {
  if (ansisupported(0)) cout << "ANSI OK";
  return 0;
}


Source: http://www.cplusplus.com/info/faq/
The compiler is "dev c++ "and says - source file not compiled
but it is not true the file is compiled..:(
but there is no roblem anymore it was just the compiler now im using visual c++
and everything works fine ;)
Topic archived. No new replies allowed.