随笔分类 -  C语言

C语言中一些常用重要的知识点
摘要:#include<stdio.h> #include<string.h> int main() { int n,i,j,k,a,cur,ok,m,l; char s[10][100001]; char d16[16][5]={"0000","0001","0010","0011","0100","0 阅读全文
posted @ 2022-01-19 17:51 早晨9点 阅读(273) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<string.h> #include<math.h> int getN(char s) { char nn; switch(s) { case '0':nn=0;break; case '1':nn=1;break; case '2':nn=2; 阅读全文
posted @ 2022-01-19 17:48 早晨9点 阅读(76) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main() { int n; scanf("%d",&n); printf("%X\n",n); return 0; } 阅读全文
posted @ 2022-01-19 17:47 早晨9点 阅读(22) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main () { int n; scanf("%d",&n); int i,j; int a[34][34]; for(i=0;i<n;i++) { for(j=0;j<=i;j++) { a[i][0]=1; a[i][j]=1; if(i>1&&j 阅读全文
posted @ 2022-01-19 17:43 早晨9点 阅读(43) 评论(0) 推荐(0)
摘要:#include <stdio.h> //3个酒店 2个房型 #include<malloc.h> typedef struct //长包房结构体 { char longtermname[20]; //长包房名称 int longtermnum; //长包房数量 }LongtermRoom; typ 阅读全文
posted @ 2022-01-19 16:36 早晨9点 阅读(592) 评论(0) 推荐(0)
摘要:1.以下程序段输出的结果是(A) ​ a=-1; ​ do ​ { a=a*a;}while(!a); 循环一次 B) 循环两次 死循环 D) 有语法错误 2.已知以下程序段,如果运行时逐个输入1,-3, 5, 8,-2,那么输出的结果是( B ) main() ​ {int i,x; ​ for( 阅读全文
posted @ 2022-01-19 16:33 早晨9点 阅读(319) 评论(0) 推荐(0)
摘要:输入一个数作为秒,将其转换为:时分秒 #include<stdio.h> int main() { int n,a,b,c; scanf("%d",&n); a=n/3600; b=(n-a*3600)/60; c=n-a*3600-b*60; printf("%d:%d:%d\n",a,b,c); 阅读全文
posted @ 2022-01-19 16:25 早晨9点 阅读(31) 评论(0) 推荐(0)
摘要:#include <stdio.h> int sum=0;//最后输出的方法总和 int p(int n,int x,int y,int a[][8],int s) { int i,j; for(i=x-1;i>=0;i--) { if(a[i][y]==s) return 0; } for(i=x 阅读全文
posted @ 2022-01-19 16:19 早晨9点 阅读(52) 评论(0) 推荐(0)
摘要:#include <stdio.h> int main() { int i,n; for(n=100;n<=999;n++) { for(i=2;i<n;i++) { if(n%i==0) break; } if(i==n) printf("%d ",n); } return 0; } 阅读全文
posted @ 2022-01-19 16:18 早晨9点 阅读(1108) 评论(0) 推荐(0)
摘要:求三个数中的最大值 闰年判断 简单数数小木块 统计偶数个数 回文数判断 找数 斐波那契数列 1.求三个数中的最大值 *试题描述* 由键盘上输入三个整数,请输出其中的最大值。 *输入* 输入三个整数,邻近两数之间用一个空格隔开。且保证整数属于int范围。 *输出* 输出三个整数中最大的一个。 *输入示 阅读全文
posted @ 2022-01-19 16:10 早晨9点 阅读(149) 评论(0) 推荐(0)
摘要:实现梯形数字 三位水仙花 判断10以内的素数 n位水仙花 1.实现梯形数字 实现如图效果 #include <stdio.h> int main() { int m,i,n; for(i=1;i<=5;i++) { for(n=1;n<=5-i;n++) printf(" "); for(m=1;m 阅读全文
posted @ 2022-01-19 16:01 早晨9点 阅读(50) 评论(0) 推荐(0)
摘要:strcat、strncat、strcmp、strncmp、strcpy、strncpy、strdup 》strcat char strcat(char * str1,char * str2); 函数功能: 把字符串str2接到str1后面,str1最后的'\0'被取消 函数返回: str1 参数说 阅读全文
posted @ 2021-08-23 13:31 早晨9点 阅读(871) 评论(0) 推荐(0)