i need help

heres my code: problem is under it::


#include <iostream>
#include <string>

using namespace std;
int start()
{
string SHIP;
SHIP = '()>';
char ENEMY = '@';
char BOOM = '*';
int SCORE = 0;
int ENEMY_KILLED = 0;
int BONUS = ENEMY_KILLED*2;

cout << "Score: "<<SCORE <<"\t"<<"Enemies Killed: "<<ENEMY_KILLED<<"\n\n";

cout << "::PLAYINGFIELD::"<<endl;
cout << SHIP << "\t\t\t\t" << ENEMY<<endl;
cout << "::PLAYINGFIELD::"<<endl<<endl;

cout << "Riddle 1: I am lighter than a feather, yet no man can hold me for very long. What am I?\n";
string RIDDLEONE;
cin >> RIDDLEONE;
getline(cin,RIDDLEONE);

bool AnswerTrue = true;
bool AnswerFalse = false;
if (RIDDLEONE == "breath"){
do{
cout << "~~CORRECT~~"<<endl<<endl;
cout << SHIP <<"--\t\t\t\t"<<ENEMY<<endl;
cout << SHIP <<"\t--\t\t\t"<<ENEMY<<endl;
cout << SHIP <<"\t\t--\t\t"<<ENEMY<<endl;
cout << SHIP <<"\t\t\t--\t"<<ENEMY<<endl;
cout << SHIP <<"\t\t\t\t--"<<ENEMY<<endl;
cout << SHIP <<"\t\t\t\t"<<BOOM<<endl;
SCORE++;
ENEMY_KILLED++;
cout <<"\n\n";
AnswerTrue = false;
}while (AnswerTrue = true);
}else if (RIDDLEONE != "breath"){
while (AnswerFalse = false){
cout << "sorry thats incorrect! your ship is now being shot.\n\n";
cout << SHIP <<"\t\t\t\t--"<<ENEMY<<endl;
cout << SHIP <<"\t\t\t--\t"<<ENEMY<<endl;
cout << SHIP <<"\t\t--\t\t"<<ENEMY<<endl;
cout << SHIP <<"\t--\t\t\t"<<ENEMY<<endl;
cout << SHIP <<"--\t\t\t\t"<<ENEMY<<endl;
cout << BOOM <<"\t\t\t\t"<<ENEMY<<endl;
AnswerFalse = true;
}
}
}
int main()
{
cout << "Welcome To Alien-Destroyer By Polleo-Dev! \n\n";
cout << "Type '1' for the Rules and 2 to Start: ";
int CHOICE_MAIN;
cin >> CHOICE_MAIN;

switch(CHOICE_MAIN){
//rules
case 1:
cout << "How It Works: \n\n";
cout << "1: You will see your ship '>' and your enemy '@' you will need to figure solve a riddle to fire at your enemy./n If you get the riddle wrong, the enemy will shoot you and you will lose.\n\n";
cout << "\n\n";
cout << "________________________________________________________________________________";
main();
break;
//start
case 2:
start();
break;
}
return 0;
}





heres the problem, everytime i run it to test it, if i put in anything for the answer to the riddle, even the correct answer (breath) it just ends the program!...help?
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
#include <iostream>
#include <string>

using namespace std;
int start()
{
	string SHIP;
	SHIP = '()>'; // Use double quotes "()>" for string literals
	char ENEMY = '@';
	char BOOM = '*';
	int SCORE = 0;
	int ENEMY_KILLED = 0;
	int BONUS = ENEMY_KILLED*2;

	cout << "Score: "<<SCORE <<"\t"<<"Enemies Killed: "<<ENEMY_KILLED<<"\n\n";

	cout << "::PLAYINGFIELD::"<<endl;
	cout << SHIP << "\t\t\t\t" << ENEMY<<endl;
	cout << "::PLAYINGFIELD::"<<endl<<endl;

	cout << "Riddle 1: I am lighter than a feather, yet no man can hold me for very long. What am I?\n";
	string RIDDLEONE;
	cin >> RIDDLEONE; 
	getline(cin,RIDDLEONE); //¿how many times do you pretend to read the answer?

	bool AnswerTrue = true; //obfuscated
	bool AnswerFalse = false;
	if (RIDDLEONE == "breath"){
		do{
			cout << "~~CORRECT~~"<<endl<<endl;
			cout << SHIP <<"--\t\t\t\t"<<ENEMY<<endl;
			cout << SHIP <<"\t--\t\t\t"<<ENEMY<<endl;
			cout << SHIP <<"\t\t--\t\t"<<ENEMY<<endl;
			cout << SHIP <<"\t\t\t--\t"<<ENEMY<<endl;
			cout << SHIP <<"\t\t\t\t--"<<ENEMY<<endl;
			cout << SHIP <<"\t\t\t\t"<<BOOM<<endl;
			SCORE++;
			ENEMY_KILLED++;
			cout <<"\n\n";
			AnswerTrue = false;
		}while (AnswerTrue = true);  // == is comparison. = is assignment ¿where does the condition change?
	}else if (RIDDLEONE != "breath"){
		while (AnswerFalse = false){ //same as above
			cout << "sorry thats incorrect! your ship is now being shot.\n\n";
			cout << SHIP <<"\t\t\t\t--"<<ENEMY<<endl;
			cout << SHIP <<"\t\t\t--\t"<<ENEMY<<endl;
			cout << SHIP <<"\t\t--\t\t"<<ENEMY<<endl;
			cout << SHIP <<"\t--\t\t\t"<<ENEMY<<endl;
			cout << SHIP <<"--\t\t\t\t"<<ENEMY<<endl;
			cout << BOOM <<"\t\t\t\t"<<ENEMY<<endl;
			AnswerFalse = true;
		}
	}
	//¿return?
}
int main()
{
	cout << "Welcome To Alien-Destroyer By Polleo-Dev! \n\n";
	cout << "Type '1' for the Rules and 2 to Start: ";
	int CHOICE_MAIN;
	cin >> CHOICE_MAIN;

	switch(CHOICE_MAIN){
		//rules
		case 1:
			cout << "How It Works: \n\n";
//next line is too long, you could divide it.
			cout << "1: You will see your ship '>' and your enemy '@' you will need to figure solve a riddle to fire at your enemy./n If you get the riddle wrong, the enemy will shoot you and you will lose.\n\n";
			cout << "\n\n";
			cout << "________________________________________________________________________________";
			main(); //error: ISO C++ forbids taking address of function ‘::main’. Use a loop instead
			break;
			//start
		case 2:
			start();
			break;
	}
	return 0;
}
You should compile with warnings
Last edited on
i dont understand how you fixed it? please explain
Topic archived. No new replies allowed.