>>4
1. LOOK AT YOUR COMPILER
2. FIND THE PROBLEMATIC FILE
3. PASTE THE CODE OF THE FILE
IF YOU DON'T CODE LIKE AN IDIOT (YOU PROBABLY DO, SINCE YOU'RE ASKING IDIOTIC QUESTIONS), YOU SHOULD BE ABLE TO PASTE IT ALL HERE.
Name:
Anonymous2009-09-29 22:03
alright fine i'll post it... here comes the ridicule
Name:
Anonymous2009-09-29 22:04
#include <cstdlib>
#include <iostream>
#include <string>
// random stats should be 8-25
using namespace std;
int hall = 0;
string name;
int time;
int money;
int intelligence;
int Highscore[10];
class main
{
void menu()
{
int selection = 0;
cout << "Enter the number for your selection:\n "
<< "1.Start Game\n"
<< "2.High Scores\n"
<< "3.Exit";
cin >> selection;
if(selection == 1)
{
cout << "Please enter the character's name\n ";
cin >> name;
cout << "Welcome to your doom," + name;
character();
menu2();
}
else if(selection == 2)
{
for (int i = 0; int size = 10; i < size; i++)
{
cout << Highscore[i] << "\n";
}
}
else if(selection == 3)
{
exit(0);
}
else
{
cout << "Please enter a valid selection.";
cin >> selection;
}
}
void character()
{
int money = (rand()%17)+8;
int time = (rand()%17)+8;
int intelligence = (rand()%17)+8;
int hall = 0;
bool win = false;
}
void ScoreBoard()
{
int max;
for (int i = 1; i <= 10; i++)
{
if (Highscore[i] > max)
{
max = Highscore[i];
}
}
}
void menu3()
{ cout <<"\a You have died\n"
<< " Your score only records if you win. Sorry.\n"
menu();
}
void menu4()
{
Highscore[1] = time + money + intelligence;
cout << "\a You have won!\n"
<< "Time = " + time + "+\n"
<< "Money = " + money + "+\n"
<< "Intelligence = " + intelligence + "+\n"
<< " Equals your score of..." + Highscore[1] + "\n"
<< "Check to see if your score made it in the top 10 list!\n";
menu();
}
void Encounters()
{
int chance = (rand()%20 + 1);
int randtime = (rand()%10);
int randmoney =(rand()%10);
int randint = (rand()%10);
if(chance <= 1 )
{
//10%
cout << " You have to grade papers.\n"
<< " You lose " +randtime + " time\n"
<< " but gain " + randmoney + " money.";
hall++;
time = time - randtime;
money = money + randmoney;
menu2();
}
else if (1 < chance <= 6 )
{
//25%
cout << "Nothing happens." << "You lose 1 time.";
hall++;
time--;
menu2();
}
else if(6 < chance <= 11)
{
//25%
cout << "You encounter a puzzle.";
puzzle();
}
else if(11 < chance <=13 )
{
//10%
cout << " You encounter a professor!"
<< " You lose " + randtime + "time....\n"
<< " but gain " + randint + "intelligence!";
hall++;
time = time - randtime;
intelligence = intelligence +randint;
menu2();
}
else if(13 < chance <=16)
{
cout << " You are attacked by grunt work!"
<< " You lose " + randtime + " time and\n"
<< + randint + " intelligence.";
hall++;
time = time - randtime;
intelligence = intelligence - randint;
menu2();
//15%
}
else if( 16 < chance <=18)
{
//10%
cout << " You encounter a graduate student.\n"
<< " You lose " + randtime + " time.";
hall++;
time = time - randtime;
menu2();
}
else if ( chance >= 19)
{
cout << "You found a nickel! Too bad it was glued to the floor..\n"
<< " Lose 1 time trying to pry the nickel off the floor.";
time--;
hall++;
menu2();
}
}
void puzzle()
{
int answer;
int q =(rand()%5);
if( q <= 1)
{
cout << "How much time do you have left?";
cin >> answer;
if ( answer != time)
{
cout << "Apparently NONE!";
menu3();
}
else
{ cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
}
if( q == 2)
{
cout << "What level COMP class is this?";
cin >> answer;
if ( answer != 2710 )
{
cout << "You must never come to class...";
menu3();
}
else
{ cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
if( q == 3)
{
cout << "What is 5 % 4?"
cin >> answer;
if (answer != 1)
{menu3();
else
{
cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
if (q == 4)
{
cout << "What is 4444 - 3107 ?"
cin >> answer;
if (answer != 1337)
{
menu3();
}
else
{
cout <<" You gain leet time! (actually just 1, sorry.)";
time++;
hall++;
menu2();
not OP. just saw disturbing lack of [code] tags #include <cstdlib>
#include <iostream>
#include <string>
// random stats should be 8-25
using namespace std;
int hall = 0;
string name;
int time;
int money;
int intelligence;
int Highscore[10];
class main
{
void menu()
{
int selection = 0;
cout << "Enter the number for your selection:\n "
<< "1.Start Game\n"
<< "2.High Scores\n"
<< "3.Exit";
cin >> selection;
if(selection == 1)
{
cout << "Please enter the character's name\n ";
cin >> name;
cout << "Welcome to your doom," + name;
character();
menu2();
}
else if(selection == 2)
{
for (int i = 0; int size = 10; i < size; i++)
{
cout << Highscore[i] << "\n";
}
}
else if(selection == 3)
{
exit(0);
}
else
{
cout << "Please enter a valid selection.";
cin >> selection;
}
}
void character()
{
int money = (rand()%17)+8;
int time = (rand()%17)+8;
int intelligence = (rand()%17)+8;
int hall = 0;
bool win = false;
}
void ScoreBoard()
{
int max;
for (int i = 1; i <= 10; i++)
{
if (Highscore[i] > max)
{
max = Highscore[i];
}
}
}
void menu3()
{ cout <<"\a You have died\n"
<< " Your score only records if you win. Sorry.\n"
menu();
}
void menu4()
{
Highscore[1] = time + money + intelligence;
cout << "\a You have won!\n"
<< "Time = " + time + "+\n"
<< "Money = " + money + "+\n"
<< "Intelligence = " + intelligence + "+\n"
<< " Equals your score of..." + Highscore[1] + "\n"
<< "Check to see if your score made it in the top 10 list!\n";
menu();
}
void Encounters()
{
int chance = (rand()%20 + 1);
int randtime = (rand()%10);
int randmoney =(rand()%10);
int randint = (rand()%10);
if(chance <= 1 )
{
//10%
cout << " You have to grade papers.\n"
<< " You lose " +randtime + " time\n"
<< " but gain " + randmoney + " money.";
hall++;
time = time - randtime;
money = money + randmoney;
menu2();
}
else if (1 < chance <= 6 )
{
//25%
cout << "Nothing happens." << "You lose 1 time.";
hall++;
time--;
menu2();
}
else if(6 < chance <= 11)
{
//25%
cout << "You encounter a puzzle.";
puzzle();
}
else if(11 < chance <=13 )
{
//10%
cout << " You encounter a professor!"
<< " You lose " + randtime + "time....\n"
<< " but gain " + randint + "intelligence!";
hall++;
time = time - randtime;
intelligence = intelligence +randint;
menu2();
}
else if(13 < chance <=16)
{
cout << " You are attacked by grunt work!"
<< " You lose " + randtime + " time and\n"
<< + randint + " intelligence.";
hall++;
time = time - randtime;
intelligence = intelligence - randint;
menu2();
//15%
}
else if( 16 < chance <=18)
{
//10%
cout << " You encounter a graduate student.\n"
<< " You lose " + randtime + " time.";
hall++;
time = time - randtime;
menu2();
}
else if ( chance >= 19)
{
cout << "You found a nickel! Too bad it was glued to the floor..\n"
<< " Lose 1 time trying to pry the nickel off the floor.";
time--;
hall++;
menu2();
}
}
void puzzle()
{
int answer;
int q =(rand()%5);
if( q <= 1)
{
cout << "How much time do you have left?";
cin >> answer;
if ( answer != time)
{
cout << "Apparently NONE!";
menu3();
}
else
{ cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
}
if( q == 2)
{
cout << "What level COMP class is this?";
cin >> answer;
if ( answer != 2710 )
{
cout << "You must never come to class...";
menu3();
}
else
{ cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
if( q == 3)
{
cout << "What is 5 % 4?"
cin >> answer;
if (answer != 1)
{menu3();
else
{
cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
if (q == 4)
{
cout << "What is 4444 - 3107 ?"
cin >> answer;
if (answer != 1337)
{
menu3();
}
else
{
cout <<" You gain leet time! (actually just 1, sorry.)";
time++;
hall++;
menu2();
Nobody is going to want to help you when you can't indent your code worth a damn.. second, check your parenthesis and brackets.If you indented correctly you could see whether they did or did not match up easily.
Name:
Anonymous2009-10-05 16:27
there is so much wrong with this code;
half these variables you didn't even declare;
i tried to fix it for you but got damb.
Name:
Anonymous2009-10-05 16:37
#include <cstdlib>
#include <iostream>
#include <string>
// random stats should be 8-25
using namespace std;
int hall = 0;
string name;
int time;
int money;
int intelligence;
int Highscore[10];
bool win = false;
class main {
void menu() {
int selection = 0;
cout << "Enter the number for your selection:\n " << "1.Start Game\n" << "2.High Scores\n" << "3.Exit";
cin >> selection;
if (selection == 1) {
cout << "Please enter the character's name\n ";
cin >> name;
cout << "Welcome to your doom," + name;
character();
menu2();
} else if (selection == 2) {
int size = 10;
for (int i = 0; i < size; i++) {
cout << Highscore[i] << "\n";
}
} else if (selection == 3) {
exit(0);
} else {
cout << "Please enter a valid selection.";
cin >> selection;
}
}
int selection;
cout << name << "You have " << (20 - hall) << "steps to go.\n";
cout << "1. Move foward (sorry, you can't turn back now)\n";
cout << "2. View character\n";
cout << "3. Read technical papers\n";
cout << "4. Search for loose change\n";
cout << "5. Quit the game\n";
cout << "Enter your selection:";
cin >> selection;
int randtime = (rand() % 10);
int randmoney = (rand() % 10);
int randint = (rand() % 10);
if (selection == 1) {
Encounters();
} else if (selection == 2) {
cout << "Time = " << time << "\n" << "Money = " << money << "\n" << "Intelligence = " << intelligence << "\n";
menu2();
} else if (selection == 3) {
cout << " You lose " << randtime << " time\n" << " but gain " << randint << " intelligence.";
menu2();
} else if (selection == 4) {
cout << " You lose " << randtime << " time\n" << " but gain " << randmoney << " money.";
menu2();
} else if (selection == 5) {
exit(0);
} else {
cout << "Please enter a valid selection.";
cin >> selection;
}
}
void menu3() {
cout << "\a You have died\n" << " Your score only records if you win. Sorry.\n";
menu();
}
void menu4() {
Highscore[1] = time + money + intelligence;
cout << "\a You have won!\n" << "Time = " << time << "+\n" << "Money = " << money << "+\n" << "Intelligence = " << intelligence << "+\n";
cout << " Equals your score of..." << Highscore[1] << "\n" << "Check to see if your score made it in the top 10 list!\n";
menu();
}
void Encounters() {
int chance = (rand() % 20 + 1);
int randtime = (rand() % 10);
int randmoney = (rand() % 10);
int randint = (rand() % 10);
if (chance <= 1) {
//10%
cout << " You have to grade papers.\n" << " You lose " << randtime << " time\n" << " but gain " << randmoney << " money.";
hall++;
time = time - randtime;
money = money + randmoney;
menu2();
} else if (chance <= 6) {
//25%
cout << "Nothing happens." << "You lose 1 time.";
hall++;
time--;
menu2();
} else if (chance <= 11) {
//25%
cout << "You encounter a puzzle.";
puzzle();
} else if (chance <= 13) {
//10%
cout << " You encounter a professor!" << " You lose " << randtime << "time....\n" << " but gain " << randint << "intelligence!";
hall++;
time = time - randtime;
intelligence = intelligence + randint;
menu2();
} else if (chance <= 16) {
//15%
cout << " You are attacked by grunt work!" << " You lose " << randtime << " time and\n" << randint << " intelligence.";
hall++;
time = time - randtime;
intelligence = intelligence - randint;
menu2();
} else if (chance <= 18) {
//10%
cout << " You encounter a graduate student.\n" << " You lose " << randtime << " time.";
hall++;
time = time - randtime;
menu2();
} else if (chance >= 19) {
cout << "You found a nickel! Too bad it was glued to the floor..\n" << " Lose 1 time trying to pry the nickel off the floor.";
time--;
hall++;
menu2();
}
}
void puzzle() {
int answer;
int q = (rand() % 5);
if (q <= 1) {
cout << "How much time do you have left?";
cin >> answer;
if (answer != time) {
cout << "Apparently NONE!";
menu3();
} else {
cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
}
if (q == 2) {
cout << "What level COMP class is this?";
cin >> answer;
if (answer != 2710) {
cout << "You must never come to class...";
menu3();
} else {
cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
if (q == 3) {
cout << "What is 5 % 4?";
cin >> answer;
if (answer != 1) {
menu3();
} else {
cout << "You gain 1 time!";
time++;
hall++;
menu2();
}
if (q == 4) {
cout << "What is 4444 - 3107 ?";
cin >> answer;
if (answer != 1337) {
menu3();
} else {
cout << " You gain leet time! (actually just 1, sorry.)";
time++;
hall++;
menu2();
}
}
}
}
}
};
i fixed it up a little bit; but it is still tragic what you are doing. it will not function as you expect it to.