1,076,188 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by Bumpehh Contributing to Articles being Marked Solved

you can change it to a 2 player-type game like this:

#include <iostream>

using namespace std;

string guess;
string answer;
int main()
{

    cout<<"enter a password for the guesser to guess\n";
    cin>>answer;

cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";

cout<<"now enter a guess\n\n\n\n\n\n\n";

cin>>guess;
    if(guess==answer){
    cout<<"\nWOOHOOO! You guessed it!\n";
    }

    if(guess!=answer){
    cout<<"\nOh no! it appears you FAIL! Hahaha!\n";
    }
}
Bumpehh
Light Poster
34 posts since Jul 2012
Reputation Points: 11
Solved Threads: 1
Skill Endorsements: 0
#include <iostream>

using namespace std;

string guess;               // Strings are a variable type to store letters
string answer = "Boom";
int main()
{
    cout<<"Case sensitive :)\n\n";
    cout<<"Try to guess my awesome password!\n";
    cin>>guess;

    if(guess==answer){
    cout<<"\nWOOHOOO! You guessed it!\n";     //Checks if the guess is right
    }

    if(guess!=answer){
    cout<<"\nOh no! it appears you FAIL! Hahaha!\n";      //checks if the guess is wrong
    }
}

here, you could also make it with a switch statement but its more complex.

and a loop for a retry, but i dont know how to do that >_<

sorry, but im a noob too :P

EDIT: i know how to do a loop, but not to make it give you a retry option. :P

Bumpehh
Light Poster
34 posts since Jul 2012
Reputation Points: 11
Solved Threads: 1
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page rendered in 0.0370 seconds using 2.46MB