Actually, the problem is that iostream is a c++ header file. Also namespaces are a c++ thing.
If you are using GCC for C, then you need to #include <stdio.h> for scanf.

If you are trying to compile C++, you need to use g++ not GCC.
You might also want to consider using cin (which is provided by iostream) rather than scanf, which is an old C function which is superceded by C++'s i/o streams implementation.

Walt, I am aware of which forum this is, but from the OP's post it's kinda ambiguous which language they are trying to write in. Are they trying to write in C or C++? They have an extremely bad mix of both in their code.

And it wouldn't be the first time that a noob incorrectly posted a C++ question in the C forum would it? How many times has C code been incorrectly posted in the C++ forum, or vice versa?

Because of the ambiguity, I simply tried to cover both bases. Does that really deserve being downvoted?

If the OP's code was intended to be C, they now know what to do to correct their code and can safely ignore the C++ related parts of my answer. If by some chance they have posted in the wrong place and were trying to write C++, they also know what they need to do.

Also my reply was a little brief because I was on my phone at the time. Thanks to the fiddly nature of my phone and the limited screen-space, my reply wasn't as comprehensive or detailed as I would have liked.

Seriously, what is your problem? Are you having a bad day or something? Lighten up! :)

Jason, Since this is the C forum, why all the C++ suggestions? Steer him correctly to C solutions.

To me, it looks like he was trying to explain the difference, since the OP doesn't seem to understand. Wouldn't the correct solution be better than the C solution?

EDIT:

Walt, I am aware of which forum this is, but from the OP's post it's kinda ambiguous which language they are trying to write in. Are they trying to write in C or C++? They have an extremely bad mix of both in their code.

And it wouldn't be the first time that a noob incorrectly posted a C++ question in the C forum would it? How many times has C code been incorrectly posted in the C++ forum, or vice versa?

Because of the ambiguity, I simply tried to cover both bases. Does that really deserve being downvoted?

If the OP's code was intended to be C, they now know what to do to correct their code and can safely ignore the C++ related parts of my answer. If by some chance they have posted in the wrong place and were trying to write C++, they also know what they need to do.

Also my reply was a little brief because I was on my phone at the time. Thanks to the fiddly nature of my phone and the limited screen-space, my reply wasn't as comprehensive or detailed as I would have liked.

Seriously, what is your problem? Are you having a bad day or something? Lighten up! :)

All been sorted out. Thanks for the help. The 6 was a typo.
As for the language I got kinda mixed up between what was used in what, it's been a while. It was suppose to be c++ so I've made the corrections.
Thanks

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...