首页 > 其他分享 >实验2

实验2

时间:2024-04-15 13:01:16浏览次数:17  
标签:main return int pause 实验 printf include

task1
`#include <stdio.h>

include <stdlib.h>

include <time.h>

define N 5

int main()
{
int number;
int i;
srand( time(0) );
for(i = 0; i < N; ++i) {
number = rand()%65 + 1;
printf("20238331%04d\n", number);
}
system("pause");

return 0;
}`

  1. line15的功能是生成一个0到65之间的随机数并用变量number接收这个随机数。

  2. 这个程序的功能是生成五组尾数是0到65之间的随机学号。

task2
`#include<stdio.h>

int main(){
char ans;
while((ans = getchar())!=EOF)
{switch(ans){
case'r': printf("stop!\n");break;
case'g': printf("go go go\n");break;
case'y':printf("wait a minute\n");break;
default:printf("something must be wrong...\n");
}getchar();}

return 0;
}`

task3
`#include<stdio.h>

include<stdlib.h>

include <time.h>

int main()
{
int x,y,i,a=1;
srand( time(0) );
x = rand()%31+1;
printf("猜猜2024年5月哪一天会是你的lucky day\n");
printf("开始喽,你有三次机会,猜吧(1~31)

标签:main,return,int,pause,实验,printf,include
From: https://www.cnblogs.com/very241925/p/18135724

相关文章

  • 实验二
    1#include<stdio.h>2#include<stdlib.h>3#include<time.h>456#defineN578intmain()9{1011intnumber;12inti;13srand(time(0));1415for(i=1;i<N;++i){16number=rand()%65+......
  • 易基因:ENCODE和modENCODE联盟的ChIP-seq实验设计指南和注意事项|干货
    大家好,这里是专注表观组学十余年,领跑多组学科研服务的易基因。ChIP-seq(染色质免疫沉淀测序)实验指南和实践(ChIP-seqguidelinesandpracticesoftheENCODEandmodENCODEconsortia),由ENCODE(EncyclopediaofDNAElements)和modENCODE(ModelOrganismENCODE)联盟研究人员撰写。文......
  • 实验2
    task11#include<stdio.h>2#include<stdlib.h>3#include<time.h>45#defineN567intmain()8{9intnumber;10inti;1112srand(time(0));//以当前系统时间作为随机种子1314for(i=0;i<N;++i){15......
  • 实验2
    1#include<stdio.h>2#include<stdlib.h>3#include<time.h>45#defineN567intmain()8{9intnumber;10inti;1112srand(time(0));1314for(i=0;i<N;++i){15number=rand()%......
  • 实验2
    任务11#include<stdio.h>2#include<stdlib.h>3#include<time.h>45#defineN567intmain()8{9intnumber;10inti;1112srand(time(0));1314for(i=0;i<N;++i){15number=rand()%65......
  • 实验二
    1.实验任务1#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5intmain(){intnumber;inti;srand(time(0));for(i=0;i<N;++i){number=rand()%65+1;printf("20238331%04d\n",......
  • 实验2
    task1.c#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5intmain(){intnumber;inti;srand(time(0));for(i=0;i<N;++i){number=rand()%65+1;printf("20238331%......
  • 实验2
    实验一#include<stdio.h>#include<stdlib.h>#include<time.h>#defineN5intmain(){intnumber;inti;srand(time(0));for(i=0;i<N;++i){number=rand()%65+1;printf("20238331%04d\n",number......
  • 实验2
    任务一:`#include<stdio.h>include<stdlib.h>include<time.h>defineN5intmian(){intnumber;inti;srand(time(0));for(i=0;i<N;++i){number=rand()%65+1;printf("20238331%04d\n",number);}return0;}`问题1:生成1到65的随机数问题2......
  • 原型设计实验
    原型设计工具比较分析:墨刀:适用领域:墨刀适用于快速原型设计和交互设计,特别适合移动应用和Web应用的设计。优点:界面简洁清晰,易于上手,适合初学者和团队合作。支持多种交互模式,如链接、滑动、弹出框等,可以较好地模拟用户操作流程。支持团队协作,可以多人同时编辑同一项目,方便团队......