Write a simple game in C

Source: Internet
Author: User

T: Write a guess number game

#include <stdio.h> #include <stdlib.h> #include <time.h>int main () {int I;int Random=0;srand ((         unsigned) time (NULL)), Random=rand ()%100;while (1) {printf ("Please input a number:\n");    scanf ("%d\n", I);    if (I>rand ()) printf ("Too large!\n");    else if (I<rand ()) printf ("Too small!\n"); else printf ("You are right!    %d\n ", Rand ());} return 0;}

Content: You want a number, I based on your instructions (guess big, guess small) guess, what you think.

Sentiment: believe that almost everyone's mobile phone is more or less a few game apps, do not know if you will also like me, think that writing these games behind the programmer 6, his life estimates only look. If, there is a teacher or the boss to give us a task of writing a game, I think my heart must be saying: "I still choose to die!" My heart hurts so bad ... "

After this, programming is not so difficult, thinking right, solid language Foundation, you can do! Speak with the facts. Look, a rookie like me wrote, a few lines of code just, start to believe it!

Small program, great fun!

This article is from the "sunshine225" blog, make sure to keep this source http://10707460.blog.51cto.com/10697460/1752703

Write a simple game in C

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.