Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ Simple testing

Name: Anonymous 2009-01-20 10:48

Sup /prog/, where's the mistake?

class ArrayBox
{
public:

int numbers[9];
//functions
};

int main()
{
ArrayBox ab;
ab.numbers[] = {12, 23, 43, 4, 15, 61, 79, 18, 9, 5};
}


u2.cpp: In function "int main()":
u2.cpp:94: Error: expected primary-expression before "]" token
u2.cpp:94: Error: expected primary-expression before "{" token
u2.cpp:94: Error: expected ";" before "{" token


isn't that the right syntax to fill an array? I'm confused.

Name: Anonymous 2009-01-20 13:11

Never mind, I alredy got it.
Now just a convention question. Should I make seperate .cpp files for seperate classes? Until now I've only done stuff with 2 classes, I just wrote it down in one cpp file. Should I create own cpp files for every class, like in Java or is it okay to leave it like that?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List