Webhosting in Pakistan
Results 1 to 11 of 11

Thread: Simple Guessing game in C++

  1. #1
    Join Date
    30 Apr 2011
    Location
    chishtian
    Age
    27
    Gender
    Male
    Posts
    50
    Threads
    11
    Credits
    0
    Thanked
    11

    Default Simple Guessing game in C++

    Webhosting in Pakistan
    #include<iostream.h>
    #include<conio.h>

    main ()
    {
    cout<<"********Guessing Game********\n********{1 to 100}********\n";
    int number, i = 1;
    int guess = 46; //any number you give
    char op;
    do{
    while (i<=5)
    {

    cout<<"Guess the number? ";
    cin>> number;
    if(number == guess) {cout<<"Congratulations!!! You Won.\n";break;}i++;
    if(number < guess) {cout<<"Sorry: Your guess is small\n";continue;}
    else {cout<<"sorry your guess is large.\n";continue;}

    }
    if(i==6)
    cout<<"Sorry Your tries finish";
    cout<<"Do you want to p lay again[y/n]? ";cin>>op;
    }
    while(op =='y');

    }

  2. #2
    RanaFaheemAg's Avatar
    RanaFaheemAg is offline Senior Member+
    Last Online
    30th December 2014 @ 11:53 PM
    Join Date
    10 Sep 2012
    Location
    Mianwali
    Age
    27
    Gender
    Male
    Posts
    38
    Threads
    12
    Credits
    0
    Thanked
    0

    Default

    nice

  3. #3
    shanibaba54 is offline Junior Member
    Last Online
    8th June 2016 @ 09:26 PM
    Join Date
    28 Jun 2014
    Age
    29
    Gender
    Male
    Posts
    2
    Threads
    0
    Credits
    0
    Thanked
    0

    Default

    Nice, I think it is related to virtual University's assignment.

  4. #4
    Join Date
    30 Mar 2012
    Location
    Tanhai ki dunya
    Age
    27
    Gender
    Male
    Posts
    260
    Threads
    101
    Credits
    -74
    Thanked
    16

    Default

    main ye game kese chalaun mene nam apna programari rakha he par mujhe programing bilkul nahi aati mujhe bataiye kese isko compile karun karun aur run karun

  5. #5
    Inam__NiaZ's Avatar
    Inam__NiaZ is offline ITD Mobile Expert
    Last Online
    11th December 2019 @ 11:07 AM
    Join Date
    09 Mar 2014
    Location
    SwanS
    Gender
    Male
    Posts
    6,327
    Threads
    218
    Credits
    8,820
    Thanked
    523

    Default

    Nice job

  6. #6
    sabinkarim's Avatar
    sabinkarim is offline Advance Member
    Last Online
    30th August 2019 @ 10:16 AM
    Join Date
    23 Feb 2009
    Location
    Multan
    Age
    56
    Gender
    Male
    Posts
    1,830
    Threads
    29
    Credits
    1,195
    Thanked
    88

    Default

    Thanks a lot.

  7. #7
    khan arbab's Avatar
    khan arbab is offline AjOoBa
    Last Online
    25th December 2019 @ 08:32 PM
    Join Date
    15 Dec 2014
    Location
    apni dhun me
    Gender
    Male
    Posts
    3,200
    Threads
    107
    Credits
    124
    Thanked
    122

    Default

    Nice

  8. #8
    bilalajk's Avatar
    bilalajk is offline Senior Member+
    Last Online
    7th June 2017 @ 12:39 AM
    Join Date
    26 Jan 2015
    Location
    bagh azad kashm
    Age
    23
    Gender
    Male
    Posts
    299
    Threads
    12
    Credits
    512
    Thanked
    8

    Default

    kya bt

  9. #9
    arslan659 is offline Junior Member
    Last Online
    7th October 2015 @ 07:04 AM
    Join Date
    17 Jan 2013
    Location
    Bhakkar
    Age
    26
    Gender
    Male
    Posts
    11
    Threads
    2
    Credits
    0
    Thanked
    0

    Default

    nice bro

  10. #10
    Arsalan 0.1's Avatar
    Arsalan 0.1 is offline Senior Member+
    Last Online
    10th February 2020 @ 10:23 PM
    Join Date
    15 Oct 2015
    Location
    Abbottabad
    Age
    24
    Gender
    Male
    Posts
    324
    Threads
    6
    Credits
    97
    Thanked
    6

    Default

    nyc

  11. #11
    Z.Programmer is offline Member
    Last Online
    11th October 2016 @ 11:38 AM
    Join Date
    06 Feb 2016
    Gender
    Male
    Posts
    158
    Threads
    13
    Thanked
    5

    Default

    Webhosting in Pakistan
    Quote Ahsan ANC said: View Post
    #include<iostream.h>
    #include<conio.h>

    main ()
    {
    cout<<"********Guessing Game********\n********{1 to 100}********\n";
    int number, i = 1;
    int guess = 46; //any number you give
    char op;
    do{
    while (i<=5)
    {

    cout<<"Guess the number? ";
    cin>> number;
    if(number == guess) {cout<<"Congratulations!!! You Won.\n";break;}i++;
    if(number < guess) {cout<<"Sorry: Your guess is small\n";continue;}
    else {cout<<"sorry your guess is large.\n";continue;}

    }
    if(i==6)
    cout<<"Sorry Your tries finish";
    cout<<"Do you want to p lay again[y/n]? ";cin>>op;
    }
    while(op =='y');

    }
    Try to warp your coding. Then it will be more easy to understand.
    Last edited by Z.Programmer; 29th February 2016 at 08:55 PM.

Similar Threads

  1. ufone free internet for symbian v5&v3 via simple server
    By Mumtaz Gboy in forum All Networks Free Internet Tricks
    Replies: 52
    Last Post: 9th October 2014, 10:12 AM
  2. android simple saever mila ha
    By Raza 834 in forum Ask an Expert
    Replies: 1
    Last Post: 23rd August 2014, 08:39 PM
  3. Replies: 5
    Last Post: 14th August 2014, 03:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •