Help me

Dec 11, 2013 at 2:48pm
Help I am getting error and I don't know where. I am new to C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  #include <iostream>
using namespace std;
{
  int sample[8];

    int i;
    int k
    for (k=0; k < 8; k++);
    if (k % 2 ==0)
    sample[k] = k;
    else
            sample[k] = k + 100;
            return 0;
}
Dec 11, 2013 at 2:57pm
remove semi-colon from end of line 8.

and use indenting and braces to make your for.. else more readable.
Last edited on Dec 11, 2013 at 2:57pm
Dec 11, 2013 at 3:02pm
move the semicolon from the end of line 8 to the end of line 7
Dec 11, 2013 at 3:10pm
Still same error and by mistae I reported mutexe... I am so sorry

#include <iostream>
using namespace std;
{
int sample[8];

int i;
int k;
for (k=0; k < 8; k++)
if (k % 2 ==0)
sample[k] = k;
else
sample[k] = k + 100;
return 0;
}
Dec 11, 2013 at 3:28pm
please listen. indent your code.

your code body needs to be inside a main function...


Last edited on Dec 11, 2013 at 3:56pm
Dec 11, 2013 at 3:31pm
where is the head of function?
Dec 11, 2013 at 3:56pm
wtf have i been reported?
Dec 11, 2013 at 3:57pm
where is the head of function?
what do you mean by that?
it worked anyway...Thank you mutexe
Dec 11, 2013 at 4:02pm
did you report me?
Dec 11, 2013 at 5:00pm
Yes by mistake.. I am so sorry.. I thought it was reply button....
Dec 11, 2013 at 5:04pm
Mutexe,
I am new to this forum and I am new to c++ so forgive me I need a lot of help in c++.
Dec 11, 2013 at 6:08pm
No worries dude :)
Topic archived. No new replies allowed.