當前位置:編程學習大全網 - 編程軟體 - 跪求這個C語言編程

跪求這個C語言編程

// test3_3.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main(int argc, char* argv[])

{

int u;

int count;

int n;

srand((unsigned)time(NULL));

u=1+rand()%10;

printf("系統產生了壹個1~10之間的整數,猜猜它是幾?\n");

printf("請輸入壹個1~10之間的整數:");

for(int i=0;i<10;i++)

{

scanf("%d",&n);

if(n>u)

printf("輸入妳輸入的數大了,再猜:");

count++;

if(n<u)

printf("輸入妳輸入的數小了,再猜:");

count++;

if(n==u)

{

if(count<=4)

{

printf("恭喜妳,猜對了!妳真牛");

break;

}

if(count>4&&count<=6)

{

printf("猜對了!只是次數有點多哈哈");

break;

}

if(count>6)

{

printf("笨笨,這麽多次才猜對");

break;

}

}

}

return 0;

}

  • 上一篇:加工中心G84攻牙的牙距是怎麽算的?
  • 下一篇:getch()函數怎麽使用
  • copyright 2024編程學習大全網