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

fffffffffffffuuuuuuck c++

Name: Anonymous 2009-09-29 21:30

I'm getting this
fatal error C1004: unexpected end-of-file found
error and I've checked all of my brackets. What else could be the problem?

Name: Anonymous 2009-09-29 22:03

alright fine i'll post it... here comes the ridicule

Name: Anonymous 2009-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 menu2()
  {
      
      if(hall == 20)
      {
        menu4();
      }
       if ((money <= 0) || (time <= 0) || (intelligence <= 0))
       {menu3();
       }
     
     
   
     
      cout <<  name + "You have " + 20 - hall + "steps to go.\n"
           << "1. Move foward (sorry, you can't turn back now)\n"
           << "2. View character\n"
           << "3. Read technical papers\n"
           << "4. Search for loose change\n"
           << "5. Quit the game\n"
           << "Enter your selection:";
      cin  >> selection;
     
      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"
               << " 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();

            }
            }
          }
  
   }
          }
      }
   }

Name: Anonymous 2009-09-29 22:15

brackets arent the problem.
Why doesn't class main go there?

Name: Anonymous 2009-09-29 22:36

Do I not need the
class main?
what should go there instead? Nothing?

Name: Anonymous 2009-09-29 23:12



ALRIGHT I FIGURED THE PREVIOUS ERROR OUT AND IT COMPILES BUT IT WON'T RUN NOW DUE TO THIS ERROR PLZ HALP

1>LINK : fatal error LNK1561: entry point must be defined

Name: Anonymous 2009-09-29 23:35

yeah I fixed that, and it compiles now.
When I try to run it however, it says this
1>LINK : fatal error LNK1561: entry point must be defined

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