Thursday, June 12, 2014

Computer (25)


Challenge 2 - from the user to enter one of the rock-paper-scissors is a random number generated by the computer being one of the select rock, paper, scissors. The two outputs are compared with the outcome for the end user to the ground, and finally the result of the game (x W x D) Let the output. # Include <stdio.h> int main () {int i = 0, j = 0; int usr, com; char * arr [4] [3] = {{"Draw", "Win", "Loss"}, {"Loss", "Draw", cintar "Win"}, {"Win", "Loss", "Draw "}, {" Rock "," Scissors "," Paper "}}; srand ((int) time (NULL)); printf ("\ t * The game of paper * \ n"); while (1) {printf ("Rock (1) Scissors (2) Paper (3) \ n"); printf ("Choise:"); scanf ("% d", & usr); usr - = 1; com = (rand ()% 2); printf ("You choise% s, Com choise% s \ n", arr [3] [usr], arr [3] [com]); cintar printf ("% s \ n", arr [usr] [com]); / * Case of Win * / if (usr-com == -1 | | usr-com == 2) i + +; / * Case of Draw * / else if (usr-com == 0) j + +; / * Case of Loss * / else break; } / * Print time of Win & Loss * / printf ("% d% s,% d% s", i, arr [0] [1], j, arr [0] [0]); return 0; }
'Study> C programming language' category of the other posts in the C programming exercise yunseongwoo by: 21-1 (0) 03/01/2008 yunseongwoo's programming in the C programming cintar challenges THREE [6] (a baseball game) (0) 2008 / 1.3 yunseongwoo's programming in the C programming challenges THREE [5] (rock, paper, scissors) (0) January 2008 challenge Programming C Programming yunseongwoo's THREE [2] (snail sort) (0) January 2008 Programming C Programming Challenge yunseongwoo's THREE [1] (an array Rotate) (1) of the C programming exercises by 02/01/2008 cintar yunseongwoo: 18-2 (0) 2008/01/01
Study (63)
Computer (25)
Gentoo (1)
[Firefox, Tips] Firefox Po ..
Oy 's Blog is powered by Daum / Designed by Daisy

No comments:

Post a Comment