首页 > 其他分享 >实验二

实验二

时间:2024-04-10 21:56:29浏览次数:17  
标签:include int number 点击 实验 printf main

点击查看代码
#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;
}

line15的作用是给number随机赋值一个[1,65]之间的整数;
代码的作用是随机生成五个学号,学号范围202383310001~202383310065.

点击查看代码
#include <stdio.h>
#include <stdlib.h>
int main(){
	char a;
	while(scanf("%c",&a)!=EOF){
		switch(a){
			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");break;
		}
		getchar();
	}
	system("pause");
	return 0;
}

点击查看代码
#include <stdio.h>
#include <stdlib.h>
int main(){
	int number,a;
	int i;
	number = rand()%30+1;
	printf("猜猜2024年5月哪一天会是你的lucky day\n");
	printf("开始喽,你有三次机会,猜吧(1-31):");
	for(i=1;i<=2;++i){
		scanf("%d",&a);
		if(a==number){
			printf("哇,猜中了");
			system("pause");
			return 0;
		}else if(a>number){
			printf("你猜的日期晚了,你的lucky day在前面哦\n");
			
		}else if(a<number){
			printf("你猜的日期早了,你的lucky day还没到呢\n");
		}
		printf("再猜(1-31):");
	}
	scanf("%d",&a);
	if(a==number){
		printf("哇,猜中了");
		system("pause");
		return 0;
	}else if(a>number){
		printf("你猜的日期晚了,你的lucky day在前面哦\n");
	}else if(a<number){
		printf("你猜的日期早了,你的lucky day还没到呢\n");
	}
	printf("次数用完了,偷偷告诉你,你的lucky day是%d号",number);
	system("pause");
	return 0;
}

点击查看代码
#include <stdio.h>
#include <stdlib.h>
int main(){
	int i,j,n,a,b;
	while(scanf("%d%d",&n,&a)!=EOF){
		double s=0;
		for(i=1;i<=n;i++){
			b=0;
			for(j=1;j<=i;j++){
				b=b*10+1;
			}
			s+=1.0*i/(a*b);
		}
		printf("n=%d,a=%d,s=%f\n",n,a,s);
	}
	system("pause");
	return 0;
}

点击查看代码
#include <stdio.h>
#include <stdlib.h>
int main(){
	int i,j;
	for(i=1;i<=9;i++){
		for(j=1;j<=i;j++){
			printf("%d*%d=%2d ",j,i,i*j);
		}
		printf("\n");
	}
	system("pause");
	return 0;
}

点击查看代码
#include <stdio.h>
#include <stdlib.h>
int main(){
	int i,j,n;
	printf("input n:");
	scanf("%d",&n);
	for(i=n;i>0;i--){
		for(j=1;j<=n-i;j++){
			printf("        ");
		}
		for(j=1;j<=2*i-1;j++){
			printf(" o \t");
		}
		printf("\n");
		for(j=1;j<=n-i;j++){
			printf("        ");
		}
		for(j=1;j<=2*i-1;j++){
			printf("<H>\t");
		}
		printf("\n");
		for(j=1;j<=n-i;j++){
			printf("        ");
		}
		for(j=1;j<=2*i-1;j++){
			printf("I I\t");
		}
		printf("\n");
	}
	system("pause");
	return 0;
}

标签:include,int,number,点击,实验,printf,main
From: https://www.cnblogs.com/dhsajkf/p/18127563

相关文章

  • 实验一
    微软的CryptoAPI简介微软的CryptoAPI是一个强大的加密工具集,它为Windows应用程序提供了一套加密服务。这个API允许开发者在他们的应用程序中实现各种加密功能,比如数据加密、解密、密钥生成和数字签名等。官网介绍https://learn.microsoft.com/zh-cn/azure/rtos/netx/netx-cr......
  • 实验一-密码引擎-3-加密API研究
    任务详情密码引擎API的主要标准和规范包括:1微软的CryptoAPI2RAS公司的PKCS#11标准3中国商用密码标准:GMT0016-2012智能密码钥匙密码应用接口规范,GMT0018-2012密码设备应用接口规范等研究以上API接口,总结他们的异同,并以龙脉GM3000Key为例,写出调用不同接口的代码,提交博客......
  • 实验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("2023831%04d\n",nu......
  • 20211208葛洺君实验一—3
    任务详情0.查找各种标准的原始文档,研究学习(至少包含CryptoAPI,PKCS#11,GMT0016-2012,GMT0018-2012)1.总结这些API在编程中的使用方式2.列出这些API包含的函数,进行分类,并总结它们的异同3.以龙脉GM3000Key为例,写出调用不同接口的代码(CryptoAPI,PKCS#11,SKF接口),4.把运行截图加......
  • 计算机网络实验九:静态路由与默认路由配置
    目录实验目的实验环境配置实验原理实验步骤及结果实验分析结论实验目的理解静态路由的含义。掌握路由器静态路由的配置方法。理解默认路由的含义。掌握默认路由的配置方法。实验环境配置装有CiscoPacketTracer的Windows计算机。三个路由器(路由器R0、路由器R1、......
  • LCEL的具体实验
    一、基本chainfromlangchain_core.output_parsersimportStrOutputParserfromlangchain_core.promptsimportChatPromptTemplatefromlangchain_community.llms.chatglm3importChatGLM3importosos.environ["LANGCHAIN_TRACING_V2"]="true"os.e......
  • 实验一-密码引擎-3-加密API研究
    一、任务详情密码引擎API的主要标准和规范包括:1微软的CryptoAPI2RAS公司的PKCS#11标准3中国商用密码标准:GMT0016-2012智能密码钥匙密码应用接口规范,GMT0018-2012密码设备应用接口规范等研究以上API接口,总结他们的异同,并以龙脉GM3000Key为例,写出调用不同接口的代码,提交......
  • 20211318 实验一-密码引擎-3-加密API研究
    任务详情:密码引擎API的主要标准和规范包括:微软的CryptoAPIRAS公司的PKCS#11标准中国商用密码标准:GMT0016-2012智能密码钥匙密码应用接口规范,GMT0018-2012密码设备应用接口规范等研究以上API接口,总结他们的异同,并以龙脉GM3000Key为例,写出调用不同接口的代码,提交博客链接......
  • 实验一-密码引擎-3-加密API研究
    实验详情:密码引擎API的主要标准和规范包括:1微软的CryptoAPI2RAS公司的PKCS#11标准3中国商用密码标准:GMT0016-2012智能密码钥匙密码应用接口规范,GMT0018-2012密码设备应用接口规范等研究以上API接口,总结他们的异同,并以龙脉GM3000Key为例,写出调用不同接口的代码,提交博客......
  • 实验一-密码引擎-3-加密API研究
    ##一、任务概览密码引擎API的主要标准和规范包括:1微软的CryptoAPI2RAS公司的PKCS#11标准3中国商用密码标准:GMT0016-2012智能密码钥匙密码应用接口规范,GMT0018-2012密码设备应用接口规范等研究以上API接口,总结他们的异同,并以龙脉GM3000Key为例,写出调用不同接口的代......