Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board My Little Guessing Game Download Source Code
Author Details Code Information
funkyjunky ( Ed George )

Pinned 2 Codes
Posted 1 Coding Articles

Send A Message
View Coders Profile
Language C++
Expires Never
Length 1,843 Characters (69 Lines)
Password no password
Description

Its something everyone has to play with when learning a language!
Unfortunatly mine is nothing new!
Enjoy!
  1. #include <stdio.h>
  2. #include <iostream>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6.  
  7. using namespace std;
  8.  
  9. void callingcard()
  10. {
  11.  
  12.           cout << "-----------------------------------------------------------------"<<endl;
  13.       cout<<"\t .o8 "<<endl;
  14.       cout<<"\t \"888 "<<endl;
  15.       cout<<"\t .ooooo. .oooo888 .oooooooo"<<endl;
  16.       cout<<"\td88' `88b d88' `888 888' `88b "<<endl;
  17.       cout<<"\t888ooo888 888 888 888 888 "<<endl;
  18.       cout<<"\t888 .o 888 888 `88bod8P' "<<endl;
  19.       cout<<"\t`Y8bod8P' `Y8bod88P\" `8oooooo."<<endl;
  20.       cout<<"\t d\" YD \t Ed George Software 2008"<<endl;
  21.       cout<<"\t t6Y88888P'"<<endl;
  22.       cout << "-----------------------------------------------------------------"<<endl;
  23.  
  24. }
  25.  
  26.  
  27. int main(){
  28.  
  29.           callingcard();
  30.  
  31.           int NumSecret, NumGuess, guess;
  32.  
  33.           guess = 0;
  34.           srand ( time(NULL) );
  35.      NumSecret = rand() % 100;
  36.           cout << "Welcome to Ed George's Random Number Game" <<endl;
  37.           cout << "Please Guess A Number! Its between 0 and 99!!" <<endl;
  38.  
  39.                     do {
  40.                               cin >> NumGuess;
  41.                               if (NumSecret<NumGuess && NumGuess <= 99) {
  42.  
  43.                               cout << "The secret number is lower"<<endl;
  44.                               ++guess;
  45.  
  46.                               }
  47.                               else if (NumSecret>NumGuess && NumGuess <= 99){
  48.  
  49.                               cout <<"The secret number is higher"<<endl;
  50.                               ++guess;
  51.  
  52.                               }
  53.                               else if (NumGuess >= 100){
  54.                   cout <<"Number is Over 99" <<endl;
  55.                   }
  56.              else{
  57.                   cout <<"Invalid Input" <<endl;
  58.                   }
  59.                     } while (NumSecret!=NumGuess);
  60.  
  61.           cout << "Congrats! The answer was "<< NumSecret <<endl;
  62.           cout << "It took you "<<guess<< " tries."<<endl;
  63.           callingcard();
  64.           cout << "Thanks For Playing" <<endl;
  65.           cin.get();
  66.  
  67. return(0);
  68.  
  69. }
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
 
funkyjunky     Posted 195 Days Ago
 
 
ugh oh yer ignore the calling card...my bad!
Page 1 of 1
 
 
Part of the MyPingle Network
Development Blog :: Make A Donation :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved