I have spent the evening trying to complete a program to be turned in before midnight. This program simulates the game Rock, Paper, Scissors. Towards the end of the code, I had thrown in the if-statments declaring 1 = rock, etc. I can't find my last mistake. Any advice guys?

BTW: I am using Dev C++ Compiler from Bloodshed.

//Kerri Byrd    
//August 2, 2004
//C14A3P779

#include <iostream>
#include <cstdlib>
#include <conio.h>

using namespace std;

int main ()
{
    int computerWins = 0;
    int myWins = 0;
    int ties = 0;
    int turns = 0;
    unsigned int computerChoice = 0;
    int myChoice = 0;
    
    srand ((unsigned) time (NULL));
    computerChoice = rand() % 4;
    
    cout << "Enter your choice: " << endl;
    cin >> myChoice;
    cout << "Computer's Choice " <<computerChoice << endl;
    
{
    if (myChoice > computerChoice)
    {
                       myWins = myWins + 1;
    }
    else
    computerWins = computerWins + 1;
    }
    if (myChoice == computerChoice)
    {
                       ties = ties + 1;
    }
    
    cout << "My Wins " << myWins << endl;
    cout << "Computer's Wins " << computerWins << endl;
    cout << "Ties " << ties << endl;
    
    getch ();
    return 0;
}



if (myChoice || computerChoice == 1)
    {
                 cout << "Rock ";
    }
    else if (myChoice || computerChoice == 2)
    {
                 cout << "Paper ";
    }
    else if (myChoice || computerChoice ==3)
    {
                 cout << "Scissors";
    }

<< moderator edit: added code tags: [code][/code] >>

Recommended Answers

All 4 Replies

This doesn't come close to compiling - what's with all the extra { and } braces?

Never mind....I have someone else helping me...thanks anyway...

You could try paying attention in class. You should not be producing anything so misformed as that.

FYI: I pay attention in class...I've already sent this program to my teacher and except for tossing in the extra code at the end, he said I almost had it right. I'm so sorry to have bothered ya'll with my request. Just ignore it from now on....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.