I'm working on using classes, and functions inside those classes. However right now I'm having a problem with my "cout" command. I'v cutted the most basic class with the cout statement into another .cpp file to help narrow the problem but now I think its just missing a ; somewhere. See below for my code... the errors I get are just before the code.
(11) : error C2143: syntax error : missing ';' before '<<'
(11) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
(11) : error C2238: unexpected token(s) preceding ';'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <cstdlib> //for srand(), rand()
#include <ctime> //for time for srand()
#include <iostream>
usingnamespace std;
class Stack
{
private:
staticconstint MAX = 52;
int j;
int nTop;
int acDeck[52];
public:
cout << endl; //This is where the error occurs
};
void main()
{
}
I think the error messages are pointing to line eleven (11) : erro C2143 ...
However, you have execuable code at line 14 that is not in a function! That is probably it! Perhaps you should define a construtor and place that line in it and try again.
It's really hard to understand what you're trying to do. You're trying to call something within a data structure, that's simply impossible, when should this line be called?