Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

The program is not solving this.

0 votes
asked Nov 11, 2019 by Ryan (120 points)
if(com==1 && chosen==3)
    {
        cout<<"Oh, yeah! Rock smashes scissors. I win.\n";
    }
    else
    {
        if(com==3 && chosen==1)
        {
            cout<<"Darn it! Rock smashes scissors. You won.\n";
        }
        else
        {
            if(com==2 && chosen==1)
            {
                cout<<"Yes! Paper covers rock. I win.\n";
            }
            else
            {
                if(com==1 && chosen==2)
                {
                    cout<<"No! Paper covers rock. You win.\n";
                }
                else
                {
                    if(com==3 && chosen==2)
                    {
                        cout<<"Scissors cuts paper. I win this round.\n";
                    }
                    else
                    {
                        if(com==2 && chosen==3)
                        {
                            cout<<"I suck. Scissors cuts paper. You win.\n";
                        }
                        else
                        {
                            cout<<"We tied.\n";
                        }
                    }
                }
            }
        }
    }

2 Answers

+2 votes
answered Nov 11, 2019 by anonymous

l do not know what did you write to the hide part of the program.l thin that 

#include<iostream>

using namespace std;

int maiin()

{
int  com,chosen;

cin>>com>>chosen;

if(com==1 && chosen==3)
    {
        cout<<"Oh, yeah! Rock smashes scissors. I win.\n";
    }

else if(com==3 && chosen==1)

{        cout<<"Darn it! Rock smashes scissors. You won.\n";}

else if(com==2 && chosen==1)

{
               cout<<"Yes! Paper covers rock. I win.\n";

            }

... 

// you must write 

//if()

//{

//}

//else if()

//{

//}
 

+1 vote
answered Nov 11, 2019 by xsevdam (350 points)
edited Nov 11, 2019 by xsevdam

//head part of the program

#include<iostream>

using namespace std;

int main()

{

int com,chosen;

cin>>com>>chosen;

if(com==1 && chosen==3)
    {
        cout<<"Oh, yeah! Rock smashes scissors. I win.\n";
    }
    else  if(com==3 && chosen==1)
        {
            cout<<"Darn it! Rock smashes scissors. You won.\n";
        }

/* you must write 

if(   )

{
...}

else if( )

{

....}

*/

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...