Line 27 of my program keeps saying I have an error. Can someone help please. I h
ID: 3620797 • Letter: L
Question
Line 27 of my program keeps saying I have an error. Can someone help please. I have put *** *** on each side of where Visual Studio 2010 says where the problem is#include <iostream>
#include <string>
#include <cstdlib>
#include <time.h>
using namespace std;
//Function Prototypes
int computer();
int user();
int conclusion(int ,int);
void directions();
int win;
//Main Function
int main()
{
srand(time(0));
directions();
user();
computer();
*** ***conclusion(user, int computer);*** *** problem area
return 0;
}
// Directions Function
void directions()
{
cout << "You are currently about to play a game of " << endl;
cout << "Rock, Paper, Scissors against the computer" << endl;
cout << endl;
cout << "To play choose whether you want Rock, Paper," << endl;
cout << "or scissors. The computer will randomly pick" << endl;
cout << "an object as well. Rock beats scissors, Paper" << endl;
cout << "covers rock, and scissors cut paper" << endl;
cout << endl;
cout << "***********************************************" <<endl;
cout << endl;
}
//Menu
int user()
{
int choice;
cout << "Please choose which object you would like:" << endl;
cout << "(1) Rock " << endl;
cout << "(2) Paper " << endl;
cout << "(3) Scissors " << endl;
cout << "(4) Exit Game " << endl;
cin >> choice;
while (choice < 1 || choice > 4 ) // Validate input
{
cout << "Invalid Selection. Enter 1, 2, 3, or 4: ";
cin >> choice;
}
return choice-1;
}
// Computer Random Function
int computer()
{
int move;
move = rand()%3;
// If state for output
if (move==0)
cout << "The computer chose rock " << endl;
else if (move==1)
cout << "The computer chose paper" << endl;
else
cout << "The computer chose scissors" << endl;
return move;
}
int conclusion (int user, int computer)
{
int win = 1;
{if (user==computer)
cout << "We Tied ";
win = 3;
if (user==0&computer==1)
cout << " My paper covers your rock. Computer wins! ";
win = 2;
if (user==0&&computer==2)
cout << "Your rock broke my scissors. You win! ";
win = 2;
if (user==1&&computer==2)
cout << "My scissors cut your paper. Computer wins! ";
win =2;
if (user==1&&computer==0)
cout << "Your rock covered my paper. You Win! ";
win =2;
if (user==2&&computer==0)
cout << "My rock broke your scissors. Computer Wins! ";
win =2;
if (user==2&&computer==1)
cout << "Your scissors cut my paper. You win!";
win =2;
}
return win;
}
Explanation / Answer
Its working fine now on borland C++ and visual studio 6.0. PLZ Rate... #include #include //#include #include //using namespace std; //Function Prototypes int computer(); int user(); int conclusion(int ,int); void directions(); int win; //Main Function int main() { srand(time(0)); directions(); user(); computer(); conclusion(user(), computer());//*** *** problem area return 0; } // Directions Function void directions() { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.