My tic tac toe game wont work

Hi. I tried to make my own tic tac toe game in c++ inspired by this video: http://xoax.net/cpp/crs/console/lessons/Lesson9/
It didn't work though. I am not very experienced coding in c++ so would appriciate if someone could point out for me what I did wrong, and why it don't work. I get up the first screen and see the board and is asked to make my move, but when i try to make my move nothing happens. I use Visual Studio C++ 2012 Express. Any help will be greatly appriciated. Thanks :)
(Sorry for bad design)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174


#include <iostream>
using namespace std;

int main() {

	// Define 
	int cSquare1 == '1';
	int cSquare2 == '2';
	int cSquare3 == '3';
	int cSquare4 == '4';
	int cSquare5 == '5';
	int cSquare6 == '6';
	int cSquare7 == '7';
	int cSquare8 == '8';
	int cSquare9 == '9';

	char iPlayerMark;
	bool iEndGame;
	
	int iPlayersTurn (1);
	bool iDraw;
	bool iGameOver = false;

	// Display board

	do {
		
	cout << cSquare1 << "|" << cSquare2 << "|" << cSquare3 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare4 << "|" << cSquare5 << "|" << cSquare6 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare7 << "|" << cSquare8 << "|" << cSquare9 << endl <<endl;
	
	
	// Tell which player's turn it is

	cout << "It is player" << iPlayersTurn << "'s turn" << endl;
	if (PlayersTurn == 1) {
		PlayerMark = 'X';
	else
		PlayerMark = 'O';
	}

	// Ask player what to do

	cout << "Enter a number from 1-9 representing the square you want to place your mark" << endl;
	
	// Does what player decided

	do {
	
	char iPlayersChoice;
	cin >> iPlayersChoice;
	bool iValidMove (true);

	if (iPlayersChoice == '1' && cSquare1 == '1') {
		cSquare1 == PlayerMark;
	}
	else if (iPlayersChoice == '2' && cSquare2 == '2') {
		cSquare2 == PlayerMark; 
	}
	else if (iPlayersChoice == '3' && cSquare3 == '3') {
		cSquare3 == PlayerMark;
	}
	else if (iPlayersChoice == '4' && cSquare4 == '4') {
		cSquare4 == PlayerMark;
	}
	else if (iPlayersChoice == '5' && cSquare5 == '5') {
		cSquare5 == PlayerMark
	}
	else if (iPlayersChoice == '6' && cSquare6 == '6') {
		cSquare6 == PlayerMark
	}
	else if (iPlayersChoice == '7' && cSquare7 == '7') {
		cSquare7 == PlayerMark
	}
	else if (iPlayersChoice == '8' && cSquare8 == '8') {
		cSquare8 == PlayerMark
	}
	else if (iPlayersChoice == '9' && cSquare9 == '9') {
		cSquare9 == PlayerMark
	else {
	cout << "Invalid move. Please try agian." << endl;
	iValidMove (false)
	}

	}
	while (!iValidMove)
	}


	cout << cSquare1 << "|" << cSquare2 << "|" << cSquare3 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare4 << "|" << cSquare5 << "|" << cSquare6 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare7 << "|" << cSquare8 << "|" << cSquare9 << endl <<endl;


	// Check if game is over

	if (cSquare1 != '1' && cSquare2 == cSquare1 && cSquare3 == cSquare1)
		iGameOver == true;
	else if (cSquare1 != '1' && cSquare4 == cSquare1 && cSquare7 == cSquare1)
		iGameOver == true;

	else if (cSquare5 != '5' && cSquare4 == cSquare1 && cSquare6 == cSquare1)
		iGameOver == true;
	else if (cSquare5 != '5' && cSquare3 == cSquare1 && cSquare7 == cSquare1)
		iGameOver == true;
	else if (cSquare5 != '5' && cSquare2 == cSquare1 && cSquare8 == cSquare1)
		iGameOver == true;
	else if (cSquare5 != '5' && cSquare1 == cSquare1 && cSquare9 == cSquare1)
		iGameOver == true;

	else if (cSquare9 != '9' && cSquare8 == cSquare1 && cSquare7 == cSquare1)
		iGameOver == true;
	else if (cSquare9 != '9' && cSquare6 == cSquare9 && cSquare3 == cSquare1)
		iGameOver == true;

	else if (cSquare1 != '1' && cSquare2 != '2' && cSquare3 != '3' 
		&& cSquare4 != '4' && cSquare5 != '5' && cSquare6 != '6' 
		&& cSquare7 != '7' && cSquare8 != '8' && cSquare9 != '9') {
			iDraw == true; 
	}

	// if Game is over, a winner might be declared

	if (iGameOver == true)
		cout << "Player" << PlayersTurn << " has won" << endl;
	else if (iDraw == true)
		cout << "The game ended in a draw" << endl;
	 
	// check if player wants to play agian

	if (iGameOver || iDraw == true) {
	cout << "Play agian? y/n" << endl;
	 char iPlayAgian;
	 cin >> PlayAgian;
	}
	if (iPlayAgian == 'y') {

	cSquare1 == '1';
	cSquare2 == '2';
	cSquare3 == '3';
	cSquare4 == '4';
	cSquare5 == '5';
	cSquare6 == '6';
	cSquare7 == '7';
	cSquare8 == '8';
	cSquare9 == '9';
		
	PlayersTurn == 1;
	iGameOver == false;
	}
	 else if (iPlayAgian == 'n')
	 iEndGame == true;

	if (PlayerTurn == '1') {
		PlayerTurn == '2';
	}
	else PlayerTurn == '1';

	// No winner is currently decided
	}
	while (iEndGame == false);


	char response;
	cin >> response;
	
	return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#include <iostream>
using namespace std;

int main() {

	// Define 
	int cSquare1 == '1';/*This makes no sense- cSquare1 is an integer, so the 1 
should be outside of the quotes. Two, you're making a comparison, not an assignment, 
which does nothing in this statement*/
	int cSquare2 == '2';//same as the comment about cSquare1
	int cSquare3 == '3';//same as the comment about cSquare1
	int cSquare4 == '4';//same as the comment about cSquare1
	int cSquare5 == '5';//same as the comment about cSquare1
	int cSquare6 == '6';//same as the comment about cSquare1
	int cSquare7 == '7';//same as the comment about cSquare1
	int cSquare8 == '8';//same as the comment about cSquare1
	int cSquare9 == '9';//same as the comment about cSquare1

	char iPlayerMark;
	bool iEndGame;
	
	int iPlayersTurn (1);/*This makes no sense. It should be int iPlayersTurn = 1, if 
you want it to hold the value 1... to be quite honest, I can't tell what you want to do 
here*/
	bool iDraw;
	bool iGameOver = false;

	// Display board

	do {
		
	cout << cSquare1 << "|" << cSquare2 << "|" << cSquare3 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare4 << "|" << cSquare5 << "|" << cSquare6 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare7 << "|" << cSquare8 << "|" << cSquare9 << endl <<endl;
	
	
	// Tell which player's turn it is

	cout << "It is player" << iPlayersTurn << "'s turn" << endl;
	if (PlayersTurn == 1) {
		PlayerMark = 'X';
	else
		PlayerMark = 'O';
	}

	// Ask player what to do

	cout << "Enter a number from 1-9 representing the square you want to place your mark" << endl;
	
	// Does what player decided

	do {
	
	char iPlayersChoice;
	cin >> iPlayersChoice;
	bool iValidMove (true);/*Again, this doesn't make sense. It should be bool 
iValidMove = true;*/

	if (iPlayersChoice == '1' && cSquare1 == '1') {/*Remove the quotes around the 
numbers*/
		cSquare1 == PlayerMark;//That's a comparison, not an assignment
	}
	else if (iPlayersChoice == '2' && cSquare2 == '2') {//Again, lose the quotes
		cSquare2 == PlayerMark; //Again, comparison, not assignment
	}
	else if (iPlayersChoice == '3' && cSquare3 == '3') {//Lose the quotes
		cSquare3 == PlayerMark;//Comparison, not assignment
	}
	else if (iPlayersChoice == '4' && cSquare4 == '4') {//The quotes. Be rid of them
		cSquare4 == PlayerMark;//Remove one of the two equal signs here
	}
	else if (iPlayersChoice == '5' && cSquare5 == '5') {//Those damned quotes
		cSquare5 == PlayerMark//That damn comparison
	}
	else if (iPlayersChoice == '6' && cSquare6 == '6') {//Running out of things to say
		cSquare6 == PlayerMark//Forgot a semicolon, AND comparison again
	}
	else if (iPlayersChoice == '7' && cSquare7 == '7') {//The quotes...
		cSquare7 == PlayerMark//Semicolon, lose one of the two equal signs
	}
	else if (iPlayersChoice == '8' && cSquare8 == '8') {//Quotes
		cSquare8 == PlayerMark//Semicolon, comparison vs. assignment
	}
	else if (iPlayersChoice == '9' && cSquare9 == '9') {//QUOTES
		cSquare9 == PlayerMark//Semicolon, comparison instead of assignment
	else {
	cout << "Invalid move. Please try agian." << endl;//Spelled again wrong
	iValidMove (false)//Should be iValidMove = false
	}/*The entire iValidMove part is useless since it doesn't require a new input. 
Use other functions, not just things inside of main() itself*/

	}
	while (!iValidMove)//Makes no sense. Should be while(iValidMove == false)
	}


	cout << cSquare1 << "|" << cSquare2 << "|" << cSquare3 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare4 << "|" << cSquare5 << "|" << cSquare6 << endl;
	cout << "-+-+-" << endl;
	cout << cSquare7 << "|" << cSquare8 << "|" << cSquare9 << endl <<endl;


	// Check if game is over

	if (cSquare1 != '1' && cSquare2 == cSquare1 && cSquare3 == cSquare1)
		iGameOver == true;//Make this assignment
	else if (cSquare1 != '1' && cSquare4 == cSquare1 && cSquare7 == cSquare1)
		iGameOver == true;//repeat

	else if (cSquare5 != '5' && cSquare4 == cSquare1 && cSquare6 == cSquare1)
		iGameOver == true;//repeat
	else if (cSquare5 != '5' && cSquare3 == cSquare1 && cSquare7 == cSquare1)
		iGameOver == true;//repeat
	else if (cSquare5 != '5' && cSquare2 == cSquare1 && cSquare8 == cSquare1)
		iGameOver == true;//repeat
	else if (cSquare5 != '5' && cSquare1 == cSquare1 && cSquare9 == cSquare1)
		iGameOver == true;//repeat

	else if (cSquare9 != '9' && cSquare8 == cSquare1 && cSquare7 == cSquare1)
		iGameOver == true;//repeat
	else if (cSquare9 != '9' && cSquare6 == cSquare9 && cSquare3 == cSquare1)
		iGameOver == true;//repeat

	else if (cSquare1 != '1' && cSquare2 != '2' && cSquare3 != '3' 
		&& cSquare4 != '4' && cSquare5 != '5' && cSquare6 != '6' 
		&& cSquare7 != '7' && cSquare8 != '8' && cSquare9 != '9') {
			iDraw == true;//repeat
	}

	// if Game is over, a winner might be declared

	if (iGameOver == true)
		cout << "Player" << PlayersTurn << " has won" << endl;
	else if (iDraw == true)
		cout << "The game ended in a draw" << endl;
	 
	// check if player wants to play agian

	if (iGameOver || iDraw == true) {//should be if((iGameOver == true) || (iDraw == true))
	cout << "Play agian? y/n" << endl;//Spelled again wrong
	 char iPlayAgian;//Spelled again wrong
	 cin >> PlayAgian;//Spelled again wrong
	}
	if (iPlayAgian == 'y') {//Spelled again wrong

	cSquare1 == '1';//make assignment
	cSquare2 == '2';//make assignment
	cSquare3 == '3';//make assignment
	cSquare4 == '4';//make assignment
	cSquare5 == '5';//make assignment
	cSquare6 == '6';//make assignment
	cSquare7 == '7';//make assignment
	cSquare8 == '8';//make assignment
	cSquare9 == '9';//make assignment
		
	PlayersTurn == 1;//make assignment
	iGameOver == false;//make assignment
	}
	 else if (iPlayAgian == 'n')
	 iEndGame == true;//make assignment

	if (PlayerTurn == '1') {
		PlayerTurn == '2';//make assignment
	}
	else PlayerTurn == '1';//make assignment (And in all of the above cases, lose the quotes

	// No winner is currently decided
	}
	while (iEndGame == false);


	char response;
	cin >> response;
	
	return 0;
}


All in all, there is a lot that needs to be done with this code to fix it. I recommend you look at the functions section of the documentation here on the site, so that you can get a better understanding of what should be done to fix up this code, such as functions being used that are defined outside of main. Also, your code never asks for user input. It's a tic-tac-toe game with no one playing.
Last edited on
Thank you very much for your help, ispil. I did everything you said, but it still won't work. Somehow, i managed to delete the project, so i just copied in my original text form above in to a new project and fixed everything you said after that. It gives me the following errors:


1>------ Build started: Project: tic tac toe med hjelp2, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(41): error C2065: 'PlayersTurn' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(42): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(43): error C2181: illegal else without matching if
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(44): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(60): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(63): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(66): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(69): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(72): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(75): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(78): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(81): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(84): error C2065: 'PlayerMark' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(85): error C2181: illegal else without matching if
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(91): error C2061: syntax error : identifier 'iValidMove'
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(95): error C2061: syntax error : identifier 'cout'
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(132): error C2065: 'PlayersTurn' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(139): error C2146: syntax error : missing ')' before identifier 'cout'
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(141): error C2065: 'PlayAgain' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(143): error C2065: 'y' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(155): error C2065: 'PlayersTurn' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(158): error C2065: 'iPlayAgian' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(161): error C2065: 'PlayerTurn' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(162): error C2065: 'PlayerTurn' : undeclared identifier
1>c:\users\synne\documents\visual studio 2010\projects\tic tac toe med hjelp2\tic tac toe med hjelp2\main.cpp(164): error C2065: 'PlayerTurn' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I don't understand them. A lot of them says something about my variables being undeclared, but thought i declared them. What am i doing wrong here? And what do you mean by "no one playing"? I thought the iPlayerChoice (which sould have been an integer) was asking for what the player wanted to do:

char iPlayersChoice;
cin >> iPlayersChoice;

And i know i should probably not have stuffed everything inside the main(), but thats what HE http://xoax.net/cpp/crs/console/lessons/Lesson9/ did. Is there a problem with my do-while loop? You stated that the iValidMove was useless since it didn't recuired new input. I thought it continued to ask for input in iPlayerChoice untill it made sure it was a number between 1-9. Am i wrong? Thanks again. I'm gratefull for your help :)
"iPlayerMark" is not the same name as "PlayerMark". "Undeclared Identifier" generally means you didn't keep the spelling of your variable names consistent (or that you didn't declare them).

Last edited on
Ispil wrote:

int iPlayersTurn (1);/*This makes no sense. It should be int iPlayersTurn = 1, if
you want it to hold the value 1... to be quite honest, I can't tell what you want to do
here*/

You can actually define and initialize variables with values using the syntax type name (value) making name = value.

Ispil wrote:

while (!iValidMove)//Makes no sense. Should be while(iValidMove == false)


This actually makes sense, ! is a logical operator that reverses the value of the variable that it is assigned to and while (iValidMove) repeats the loop while iValidMove is true, then !while (!iValidMove) repeats the loop while iValidMove is false.

Ispil wrote:

if (iGameOver || iDraw == true) {//should be if((iGameOver == true) || (iDraw == true))


This is another instance you're providing false information to the OP. conditionals, when used without any operators, test the variable for truth by default
1
2
3
if (variable == true) // Not necessary
Could have
if (variable) // Will test if variable is true, and if so will proceed. 


I would recommend you go over this page Ispil: http://www.cplusplus.com/doc/tutorial/control/

@ jvk971 - You are making some beginners mistakes. Please review the errors and try to determine what they mean. undeclared identifier means that the Variable named directly preceding that error has not been defined. For example, I see you are using alot of PlayerTurn and PlayerMark without the i prefixed. It should be iPlayerturn and iPlayerMark... Etc,
Last edited on
This is another instance you're providing false information to the OP. conditionals, when used without any operators, test the variable for truth by default


Whilst that particular statement works, there is a common misunderstanding that OP may have: the operator == is not distributive, so it would be an error to write:

1
2
if ( x || y == 0); // not the same as:  if ( x == 0 || y == 0 )
if ( (x || y) == 0); // also wrong  
Last edited on
Ok, so fixed some of the errors mentioned like the missing "i", and some others i found. I thought my program was going to work now, but instead i got even more errors! What is this?
A lot of them are syntax errors, whatever that is. Looks like there is something wrong with my if and else. And i also noticed that it dosen't understand that cout or cin anymore. It automatically thinks of them as integers. Why? I have included the using namespace std at the top, so it shouldn't be a problem. And i don't understand the missing ";" before "}", and those which are similar.
I really want this program to work, but it seems like for every error i fix, i get two more. Please help.
Here are my errors:

1>------ Build started: Project: tic tac toe med hjelp3, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\synne\main.cpp(49): error C2061: syntax error : identifier 'cout'
1>c:\users\synne\main.cpp(92): error C2061: syntax error : identifier 'iValidMove'
1>c:\users\synne\main.cpp(96): error C2143: syntax error : missing ';' before '<<'
1>c:\users\synne\main.cpp(96): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(97): error C2143: syntax error : missing ';' before '<<'
1>c:\users\synne\main.cpp(97): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(97): error C2086: 'int cout' : redefinition
1> c:\users\synne\main.cpp(96) : see declaration of 'cout'
1>c:\users\synne\main.cpp(98): error C2143: syntax error : missing ';' before '<<'
1>c:\users\synne\main.cpp(98): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(98): error C2086: 'int cout' : redefinition
1> c:\users\synne\main.cpp(96) : see declaration of 'cout'
1>c:\users\synne\main.cpp(99): error C2143: syntax error : missing ';' before '<<'
1>c:\users\synne\main.cpp(99): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(99): error C2086: 'int cout' : redefinition
1> c:\users\synne\main.cpp(96) : see declaration of 'cout'
1>c:\users\synne\main.cpp(100): error C2143: syntax error : missing ';' before '<<'
1>c:\users\synne\main.cpp(100): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(100): error C2086: 'int cout' : redefinition
1> c:\users\synne\main.cpp(96) : see declaration of 'cout'
1>c:\users\synne\main.cpp(105): error C2059: syntax error : 'if'
1>c:\users\synne\main.cpp(107): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(110): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(112): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(114): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(116): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(119): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(121): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(124): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(126): error C2143: syntax error : missing ';' before '{'
1>c:\users\synne\main.cpp(126): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\synne\main.cpp(132): error C2059: syntax error : 'if'
1>c:\users\synne\main.cpp(134): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(139): error C2059: syntax error : 'if'
1>c:\users\synne\main.cpp(140): error C2143: syntax error : missing ')' before ';'
1>c:\users\synne\main.cpp(142): error C2143: syntax error : missing ';' before '>>'
1>c:\users\synne\main.cpp(142): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(144): error C2059: syntax error : 'if'
1>c:\users\synne\main.cpp(144): error C2143: syntax error : missing ';' before '{'
1>c:\users\synne\main.cpp(144): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\synne\main.cpp(159): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(162): error C2059: syntax error : 'if'
1>c:\users\synne\main.cpp(162): error C2143: syntax error : missing ';' before '{'
1>c:\users\synne\main.cpp(162): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\synne\main.cpp(165): error C2059: syntax error : 'else'
1>c:\users\synne\main.cpp(168): error C2059: syntax error : '}'
1>c:\users\synne\main.cpp(168): error C2143: syntax error : missing ';' before '}'
1>c:\users\synne\main.cpp(168): error C2059: syntax error : '}'
1>c:\users\synne\main.cpp(173): error C2143: syntax error : missing ';' before '>>'
1>c:\users\synne\main.cpp(173): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\synne\main.cpp(173): error C2086: 'int cin' : redefinition
1> c:\users\synne\main.cpp(142) : see declaration of 'cin'
1>c:\users\synne\main.cpp(175): error C2059: syntax error : 'return'
1>c:\users\synne\main.cpp(176): error C2059: syntax error : '}'
1>c:\users\synne\main.cpp(176): error C2143: syntax error : missing ';' before '}'
1>c:\users\synne\main.cpp(176): error C2059: syntax error : '}'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Anyone? @Ispil @Giraffatron ??
In c++ ALWAYS fix first error and syntax just means the compiler found the error and its not like an error in your math or something the compiler can not fix and tbh all those errors are useless except the first. Create an empty proj and don't put a semicolon after a variable then create a few more variables and I'm sure u get plenty errors when you only need to fix first. And your error with cout is probably that semicolon before or u don't have the namespace eg std::cout <<
Topic archived. No new replies allowed.