This is the First game i maded in C++ this maybe usefull for newbs. who want to learn C++ the Source Contains: If Triggers, Loops, Random, Variables and Functions.
The Source:
Code:
/*
Maded by: Iron Skull
Maded on: 26-11-'05
*/
#include <iostream>
#include <stdlib.h>
int MenuFunction;
int GameStart(void);
int GuessedNumber;
int RightNumber;
int lives;
int main (void)
{
lives = 3;
std::cout << "\t\t\tWelcome to Guess the Number!\n";
std::cout << "\t\t\tMaded by: Robin Vossen\n\n";
std::cout << "\tMenu:\n\t1 - Start Game\n\t2 - Help\n\t3 - Quit Game\n\n";
while (MenuFunction =! 0)
{
std::cout << "Pick Command:\n";
std::cin >> MenuFunction;
if (MenuFunction == 1){
/*Game Start*/
GameStart();
break;
}else if (MenuFunction == 2){
/*Show Help*/
std::cout << "This is Help...\n";
}else if (MenuFunction == 3){
/*Quit App*/
break;
}
}
return 0;
}
int GameStart(void)
{
RightNumber = rand() % 100;
RightNumber++;
StartOfGame:
GuessedNumber = 0;
std::cout << "Now you have to pick a number between 1 and 100\n";
std::cin >> GuessedNumber;
if (GuessedNumber == RightNumber){
std::cout << "\aY\ao\au\a \aG\au\ae\as\as\ae\ad\a \at\ah\ae\a \an\au\am\ab\ae\ar\a!\a\n\n\n";
main();
}else{
lives = lives - 1;
if (lives > 0){
std::cout << "Wrong Number you still have " << lives << " chance(s)!\n";
goto StartOfGame;
}else{
std::cout << "Game Over!\nThe Right Number was " << RightNumber << "\n";
}
}
return 0;
}
VBDeceiver. You have 17 posts... havent you seen the front page at all?
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.