![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
test
xhZhangShaoFan
只准失败,不准放弃——梅耶马斯克
展开
-
test15:数组交换
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ int arr1[] = { 1,3,5,7,9 }; int arr2[] = { 2,4,6,8,10 }; int tmp = 0; int sz = sizeof(arr1) / sizeof(arr1[0]); for (int i = 0; i < sz; i++) { printf("%d ", arr1[i]); }pr原创 2021-03-07 16:38:02 · 83 阅读 · 0 评论 -
test14:数组逆序打印
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ int arr[] = { 1,2,3,4,5,6,7,8,9,10 }; int sz = sizeof(arr) / sizeof(arr[0]); printf("%d\n", sz);//计算数组个数 for (int i = 0; i < sz; i++) { printf("%d ", arr[i]);//正序打印 } printf("原创 2021-03-07 16:18:41 · 78 阅读 · 0 评论 -
test13:指针数组(存放指针的数组)
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ int a = 10, b =20, c =30; int* arr[3] = { &a,&b,&c }; for (int i = 0; i < 3; i++) { printf("%d ",*(arr[i])); } return(0);}原创 2021-03-06 17:11:40 · 168 阅读 · 0 评论 -
test12:strcpy()、strcat()、strlen()字符串复制、字符串连接、字符串求长度函数的简单功能使用
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<string.h>int main(){ char str1[14] = "runoob"; char str2[14] = "google"; char str3[14]; strcpy(str3, str1);// 复制 str1放到 str3 printf("str3:%s str1:%s\n", str3,str1); strcat(s原创 2021-03-06 13:52:59 · 165 阅读 · 0 评论 -
test11:指针方式打印数组的1-10数字异或地址
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ int arr[10] = { 1,2,3,4,5,6,7,8,9,10 }; int i = 0; int sz = sizeof(arr) / sizeof(arr[0]); int* p = arr; for (i = 0; i < sz; i++) { printf("%d ", *p); p += 1; }}原创 2021-03-05 14:48:54 · 156 阅读 · 0 评论 -
test10:指针改变数组下标元素
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ int arr[5] = { 0,1,2,3,4 }; int* p = arr;//定义指针指向数组首元素下标0位置 printf("%d\n", arr[0]);//改值前 *p = 9;//对下标0位置重新赋值 printf("%d\n", arr[0]);//改值后}...原创 2021-03-01 19:01:33 · 188 阅读 · 0 评论 -
test9:Windows下C/C++获取当前系统时间
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include <time.h>int main(){ time_t t = time(0); char tmp[64]; strftime(tmp, sizeof(tmp), "%Y/%m/%d %X %A 本年第%j天 %z", localtime(&t)); puts(tmp); return 0;}...原创 2021-02-26 21:15:37 · 71 阅读 · 0 评论 -
分析题8:printf()函数遇上前置++后置++及进制转换程序
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ int a = 011;//八进制的011=十进制9 printf("%d\n",a);//输出9 printf("%x\n", ++a);//前置++,先运算再赋值,所以是9+1=10后再转16进制 //十进制9=十六进制9;十进制10=十六进制a;十进制11=十六进制b int b = 101;//十进制101 printf("%d\n", b);//.原创 2021-02-26 20:45:40 · 157 阅读 · 1 评论 -
test5:<题库随机练习,每日10题>
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>//rand()随机数函数的头文件#include<time.h>//srand()和time()要用到的头文件int main(){ int i = 0; int count = 1; int num = 0; printf("请输入总题库数:>"); scanf("%d", &num); srand((原创 2021-02-26 16:45:38 · 125 阅读 · 0 评论 -
test4:整型提升 \ char short 例0xb6 分析if判断式 \ 隐式类型转换
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main(){ char a = 3;//写上char的一瞬间,机器默认就发生整型提升了<第一次整型提升> char b = 127;//写上char的一瞬间,机器默认就发生整型提升了<第一次整型提升> printf("%d\n", a + b);//这时还是int型的 char c = a + b;//这时发生<第二次整型提升> prin原创 2021-02-26 16:24:39 · 652 阅读 · 2 评论 -
test3:汉子式 代码雨
<!DOCTYPE html><html><head> <title>KuiaLe制代码雨</title></head> <body><canvas id="canvas"></canvas><style type="text/css"> body{margin: 0; padding: 0; overflow: hidden;}</style>.原创 2021-02-26 08:43:41 · 187 阅读 · 1 评论 -
test2:最简结构体程序 \ 指针的2种不同书写形式
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>//创建一个结构体类型-structStustruct Stu{ //成员变量 char name[20]; int age; char id[20];};int main(){ int a = 10; //使用struct Stu这个类型开辟创建了一个学生对象s1,并初始化 struct Stu s1 = { "张三",20,"20210225" }; //s1既然是原创 2021-02-25 23:26:45 · 100 阅读 · 1 评论 -
test1:在PC中不同类型数据的输出长度
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main()//{ printf("sizeof(char)=%d\n", sizeof(char)); printf("sizeof(short)=%d\n", sizeof(short)); printf("sizeof(int)=%d\n", sizeof(int)); printf("sizeof(long)=%d\n", sizeof(long)); printf(原创 2021-02-25 15:01:25 · 113 阅读 · 0 评论