The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
due today. need help because mine failed. need it as soon as possible
////main.c//daily11////Created by Michelle Anggara on 9/30/15.//Copyright (c) 2015 Michelle Anggara. All rights reserved.//#include <stdio.h>int main(){char tool1; //variable to store tool for player 1char tool2; //variable to store tool for player 2//Prompt for valuesprintf("Enter tool for player 1 (P,R,or S): ");scanf("%c",&tool1);getchar();//to clear input bufferprintf("Enter tool for player 2 (P,R or S): ");scanf("%c",&tool2);if(toupper(tool1)=='P'){if(toupper(tool2)=='R'){printf("Player 1 wins!\n");printf("Paper covers rock.\n");}else if(toupper(tool2)=='S'){printf("Player 2 wins!\n");printf("Scissors cut paper.\n");}else {printf("Draw, nobody wins!\n");}}else if (toupper(tool1)=='R'){if(toupper(tool2)=='P'){printf("Player 2 wins!\n");printf("Paper covers rock.\n");}else if(toupper(tool2)=='S'){printf("Player 1 wins!\n");printf("Rock breaks scissors.\n");}else{printf("Draw, nobody wins!\n");}}else if(toupper(tool1) == 'S'){if(toupper(tool2)=='P'){printf("Player 1 wins!\n");printf("Scissors cut paper.\n");}else if(toupper(tool2)=='R'){printf("Player 2 wins!\n");printf("Rock breaks scissors.\n");}else{printf("Draw, nobody wins!\n");}}system("PAUSE");
COMP 91.101 (201, 202, 204)Assignment 13, 10-02-2015F15 - Dr. LinDue date:10-05-2015 (Monday.), 2pmSubmission: C source file,daily13.c, on BlackboardDescription:Create a project called Daily13. Add a C source file to the project named daily13.c.Write a program to score the paper-rock-scissors game AGAIN. Each of two players enters eitherP, R, or S. The program then announces the winner as well as the basis for determining the winner:“Paper covers rock”, “Rock breaks scissors”, “Scissors cut paper”, or “Draw, nobody wins”. The playersmust be able to enter either upper- or lower-case letters.The primary difference between this daily and daily 11 is that in this one you MUST use afunction to get the input value for the player’s choice. The function MUST return an enumerated typecalled Choice that has three values, ROCK, PAPER, and SCISSORS. This makes it so that the only part ofyour program that pertains to the player choices that can involve character variables is the inputportion. The rest of your program should always use variables of the enumerated Choice type and theend result should be that your program is easier to read.The function prototype should be like:ChoicefunctionName ();//Inside your function, you will read a valid input//from the keyboard, and decide the choice//for that input, and return the value (a Choice type//variable)When you call the function, you will need a Choice variable to save the value in the callingfunction. e.g.,ChoiceuserChoice = functionName();Your program output should look the same as before, like the following:
Attachments: