> C Computer Programming Class?

C Computer Programming Class?

Posted at: 2014-12-18 
If you seriously want do C programming then you have to joint Programming coaching class. That is not the way to do programming. C is base of any programming. If base is strong you can do everything. So Do not try to understand it self. take it serious and join classes.

Thanks.

To generate the random number use

#include

#include

srand (time (NULL)); // call only once

int r = (rand() % 3);

Break this down into simple single statements. This is called pseudo code. After you have worked out the logic and flow of the app via pseudo code, you convert it to the actual code.

Generate a random number from 0 to 2.

Ask the user to enter a number from 0 to 2 where scissors = 0, rock =1, and paper = 2.

Compare user input to generated number.

0 vs 1 = scissor wins

0 vs 2 = rock wins

1 vs 2 = paper wins.

There are a couple of ways to do the comparison. you could do it with if statements or you could simply calculate the total of the numbers such that:

1 = scissors wins; 2 = paper wins; 3 = rock wins.

Using if's would look something like this:

if computer = 0 {

if player =1 { scissors wins}

else {rock wins}

}

if computer == 1 {

...

}

}

I am still trying to understand how to do C Programming can someone help me!?

Write a program that plays the scissor-rock-paper game. As you know, the rules

are as follows.

A scissor can cut a paper.

A rock can knock a scissor.

A paper can wrap a rock.

The program randomly generates a number 0, 1, or 2.

The number represents scissor (0), rock (1), and paper (2), respectively.

The program prompts the user to enter a number 0, 1, or 2 and displays the result

describing whether the user or the computer wins, loses or draws.

The sample result is as follows.

-----------------------------------------------------------------------------------

Select one from Scissor (0), rock(1), paper(2): 1 ?Enter

The computer is scissor. You are rock. You won!!!