Jump to content
  • Advertisement
Sign in to follow this  
hothead

I made my first game

This topic is 5469 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!