Sign in to follow this  
hothead

I made my first game

Recommended Posts

I've finished my first game here it is but it always says you lose
//game of rock paper sissors

#include<iostream>
#include<cstdlib>
#include<ctime>


using namespace std;
int main()
{
const int rock=1;
const int paper=2;
const int sissors=3;

    srand(time(0));//seed the random generater
    int mychoice = 1;
        cout<<"enter rock1,paper2 or sissors3";
                cin>>mychoice;
    int choice = rand()%3,Oput; 
        if((mychoice == rock) && (choice == paper))
    {
    cout<<"\nyou lose";
    }
        if((mychoice == paper) && (choice == rock))
    {
    cout<<"\nyou win";
     }   
        if((mychoice == sissors) && (choice == rock))
    {
    cout<<"\nyou lose";
     }  
         if((mychoice == rock) && (choice == sissors))
    {
    cout<<"\nyou win";
     }   
        if((mychoice == paper) && (choice == sissors))
    {
    cout<<"\nyou lose";
     }   
        if((mychoice == sissors) && (choice == paper))
    {
    cout<<"\nyou win";
     }  
       if((mychoice == sissors) && (choice == paper))
    {
    cout<<"\ntie";
     }   
        if((mychoice == paper) && ( choice == paper))
    {
    cout<<"\ntie";
     }  
         if((mychoice == rock) &&(choice == rock))
    {
    cout<<"\ntie";
    }
    cin>>Oput;
    return 0;
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
maybe you just suck at rock, paper, sissors

You should output your pick and the computer's pick so you can check its answer.

Share this post


Link to post
Share on other sites
Quote:
Original post by hothead
I'm sure because I have the worst luck in the world:(



#include <iostream>
#include <cstdlib>
using namespace std;

int main()

{

string vegas;

cout << "Ever gone to Vegas?" << endl << endl;
cout << "> Yes" << endl;
cout << "> No" << endl << endl;
cout << "> ";
cin >> vegas;

if (vegas == "Yes")

{

system("cls");
cout << "You poor person, but no really, how did you do?" << endl << endl;
system("PAUSE");

}

if (vegas == "No")

{

system("cls");
cout << "Don't plan on going!" << endl << endl;
system("PAUSE");

}

return 0;

}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this