All pastes #233036 Raw Edit

Stuff

public text v1 · immutable
·published 2006-11-01 18:39 UTC
rendered paste body
#include <iostream>    // Omg the almighty first header file O.o
#include <windows.h>

using namespace std;    // something mirchiss likes xD


// start of the clearscreen code  to use it ---> clrscr();


void clrscr(void) 
    { // clear screen function  
    COORD                       coordScreen = { 0, 0 };
    DWORD                       cCharsWritten;
    CONSOLE_SCREEN_BUFFER_INFO  csbi;
    DWORD                                       dwConSize;
    HANDLE                      hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hConsole, &csbi);
    dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
    FillConsoleOutputCharacter(hConsole, TEXT(' '), 
                               dwConSize, coordScreen, &cCharsWritten);
    GetConsoleScreenBufferInfo(hConsole, &csbi);
    FillConsoleOutputAttribute(hConsole, csbi.wAttributes, 
                               dwConSize, coordScreen, &cCharsWritten);
    SetConsoleCursorPosition(hConsole, coordScreen);
    }
// end 

void SHOP() 
{
     int YourMoney = 5000;
     int Sword = 1000;
     int Axe = 2000;
     int Pole = 1500;
     int Blunt = 2500;
     int item;
     
     cout << "\n";
     cout << "\t\t A Friendly man Says Hello to you";
     cout << "\n";
     cout << "\t\t You reply Hi";
     cout << "\n";
     cout << "\t\t What do you want to buy?";
     cout << "\n";
     cout << "\t\t He shows you some items: ";
     cout << "\n";
     cout << "\t\t 1. Sword costs --> " << Sword;
     cout << "\n";
     cout << "\t\t 2. Axe costs --> " << Axe;
     cout << "\n";
     cout << "\t\t 3. Pole costs --> " << Pole;
     cout << "\n";
     cout << "\t\t 4. Blunt costs --> " << Blunt;
     cout << "\n";
     cout << "\t\t You're money is " << YourMoney;
     cout << "\n";
     cout << "\t\t What do you want to buy?";
     cout << "\n";
     cin >> item;
     
     switch (item) 

{
     case 1:
          
          clrscr();
          cout <<"you bought a Sword you're money is now" << YourMoney - Sword;
          cin.get();
          break;
          
     case 2:
     
          clrscr();
          cout <<"you bought a Axe you're money is now" << YourMoney - Axe;
          cin.get();
          break;
          
     case 3:
     
          clrscr();
          cout <<"you bought a Pole you're money is now" << YourMoney - Pole;
          cin.get();
          break;
          
     case 4:
     
          clrscr();
          cout <<"you bought a Blunt you're money is now" << YourMoney - Blunt;
          cin.get();
          break;
          
}

}
     
void STSCREEN()   // Start game screen
{
     int input;
     cout << "\n";
     cout << "\t\tWelcome in this town called Urgath";
     cout << "\n";
     cout << "\t\tOn your left we have a Shop";
     cout << "\n";
     cout << "\t\tOn your right we have a Blacksmithshop";
     cout << "\n";
     cout << "\t\tOr you can walk to the Battle Zone"; 
     cout << "\n";
     cout << "\t\tWhere you want to go?";
     cout << "\n";
     cout << "\t\t1. To the Shop";
     cout << "\n";
     cout << "\t\t2. to the Blacksmith Shop";
     cout << "\n";
     cout << "\t\t3. to the Battle Zone";
     cout << "\n";
     cin >> input;
     
     switch (input) 
{
            
            case 1:
                 
                 clrscr();                   // Points to the Shop.
                 SHOP();
                 break;
                 
            case 2: 
                                  
                 //source code
                 break;
            
            case 3:
                                  
                 //source code
                 break;
}
                 
}
                 // END OF THE STSCREEN OF THE GAME
                 


                   
                         
             
     
     
int main () {       // the Main fucntion it is oh yes

     int input;

     cout << "\t\t Make a selection";
     cout << "\n";
     cout << " \t\t 1. Start Game ";      // option 1
     cout << "\n";
     cout << " \t\t 2. Exit";  // option 2
     cout << "\n";
     cin >> input;
     cin.get();
 
     
     switch (input) {
            
            case 1:
                 clrscr();
                 STSCREEN();
                 cin.get();
                 break;
            case 2:
                 clrscr();
                 cout << "Tnx for playing My Little game";
                 cin.get();
                 break;
                 
            default:           
                 clrscr();
                 cout << "Bad Input you funky guy"; // if you putt bad in put
                 cin.get();
                 break;
  }
  
  return 0;
  
  
}