自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(28)
  • 收藏
  • 关注

原创 查询ASCII码值程序

#include <conio.h>#include <iostream>#include <stdio.h>int main(){ int ch; int a; printf("输入空格后退出程序,请输入你想查询的ASCII码\n"); for (;;) { if (_kbhit()) { //如果有按键按下,则_kbhit()函数返回真 .

2021-12-17 11:29:05 863

原创 单链表实操讲解

#include<stdio.h>#include<stdlib.h>//包含malloc,free,rand //需要使用一个指针来表示链表 typedef struct Book//由此定义整个结构体格式 { char name; int price; struct Book* next; //next是一个结构体指针,格式是结构体格式 ,指针指向自身成员 }Book;//typedef 是一个重命名操作,将struct Boook 以Book进行替代 .

2021-11-22 13:59:40 692

原创 关于scanf清除缓冲区

今天写到scanf突然发现缓冲区输入不定时,对于清除缓冲区很麻烦,而去网上查了几种效果也不是很理想,自己综合网上的方法写了一个如果单独使用getchar()函数一次只能清除一个,但是对于输入不定的情况而言虽然能用但是不是很理想,所以要和循环配套使用,而循环的使用需要结束条件,此时条件为getchar()!='\n'即可,故,整体为float a=0; for(;;) { printf("Enter :"); scanf("%f",&a); if(getchar

2021-11-16 15:54:34 1127

原创 2021/10/26写着玩的

#include<stdio.h>//判断101-200之间素数的多少int main(){int a=0;int b;int c=101;for(b=101;b!=201;b++){ for(a=2;a!=b;a++) { if(b%a!=0) continue; else if(b%a==0) { c--; break; } }}return c; }

2021-10-26 10:04:56 77

原创 2021/10/25

练手#include<stdio.h>#include<math.h>float hp(float*pa,float*pb){ return sqrt(pow(*pa,2)+pow(*pb,2));}int main(){float a,b,e;scanf("%f%f",&b,&a);printf("num is equal to %f",e=hp(&a,&b));}

2021-10-25 17:08:18 63

原创 2021/10/20写个小病毒玩玩

#include<stdio.h>#include<stdlib.h>#include<stdlib.h>#include<string.h>int main(){ char arr[100]={0}; char li[]="我是傻逼" ; for(;;) { printf("请输入:我是傻逼,否则60秒后关机\n"); system("shutdown -s -t 60"); scanf("%s", arr); .

2021-10-20 10:51:31 69

原创 2021/10/18选择排序法练习

#include<stdio.h>//将arr从小到大排序 int main(){ int a = 0;//.用来记录数组长度 int b = 0, c = 0;//用来循环 int d = 0;//用来记录数组中最小值 int e = 0;//用来保存角标 int i = 0; int arr[] = { 1513,48965,7984,65,123165846,2,846,21354,5184,3157864,3211,351 }; a = sizeof(arr) .

2021-10-18 16:23:03 62

原创 2021/10/11冒泡排序法的c语言实现

#include<stdio.h>int main(){ int a=0, b=0, c=0,d=0; printf("how many num in this array\n"); scanf("%d",&a); int arr[a]={}; for(b=0;b<a;b++) { printf("please enter a num:"); scanf("%d",&c); arr[b]=c; } printf("the organia.

2021-10-11 19:18:12 79

原创 2021/10/11随手写,随手写的没啥意思

#include<stdio.h>int main(){ int a = 0, b = 0, c = 0, d = 0, e = 1; for (; e == 1;) { printf("please choose your mathematical operations(add(1),multiply(2),modulus(3))\n"); scanf_s("%d", &a); printf("please enter two nums\n"); sc.

2021-10-11 15:51:16 65

原创 2021/10/7练手训练(2)

常见的关键词辨识1.auto,自动局部变量又称为自动变量#include<stdio.h>int main(){int a=0;return 0;}这里的a是局部变量,其实是简化了auto int a=0这段代码

2021-10-07 13:12:53 59

原创 2021/10/7学习感悟

对于循环,并不像seitch分支语句中拥有default指令,这时可以选择使用循环加if的结构来完成最后结果,例如while(a<=b){\\n内容}if(a>b){\\内容}这样的结构,两面取反来达到效果顺手写了一个昨天的查找序列的更改版,上一个版本是随机数列的查找,这个是使用二分法的有序序列查找。序列随手写的,无关紧要#include<stdio.h> //使用二分法验证一个数字是否存在于一个已有顺序的数组中int main(){

2021-10-07 11:31:32 58

原创 2021/10/6练手训练(2)

#include<stdio.h>//验证一个数字是否存在于一个已有的数组中int main(){ float arr[] = { 5,56 ,8.6 ,5.8 ,4.15,1,2.2 ,2.1,54 }; int sz = sizeof(arr) / sizeof(float); int a = 0, c=0; float b=0; printf("please enter a num\n"); scanf_s("%f", &b); for (a = 0; a .

2021-10-06 20:25:29 53

原创 2021/10/6假期休息后的恢复训练

#include <stdio.h>int main(){ int n = 0, m = 1, q = 0,p=0; printf("please enter the num n\n"); scanf_s("%d", &n); for (; n != 0; n--) { m = 1; p = n; for (; p != 0; p--) { m = m * p; } q = q + m; } printf("%d", q);}写一段.

2021-10-06 19:55:46 87

原创 2021/9/30密码验证程序(改)

#include<stdio.h>int CHANGE(int rpassword){printf("please enter the new password\n");scanf_s("%d", &rpassword);return rpassword;}int main(){ int password = 0; int a = 0,b=1; char A; int rpassword[] = { 123456 }; printf("do you want.

2021-09-30 18:59:06 78

原创 2021/9/28,密码修改程序

#include<stdio.h> //写一个密码验证程序int CHANGE(int rpassword){ printf("please enter a new password\n"); scanf_s("%d", &rpassword); return rpassword;}int main(){ int password = 0 ; int a = 0; int b = 0, d = 0, e = 0; int rpassword[] = .

2021-09-28 10:39:29 143

原创 2021/9/27密码验证程序(更改完成版)

#include<stdio.h> //写一个密码验证程序int main(){ int password = 0 ; int a = 0; int d = 0, e = 0; int rpassword[] = { 123456 }; while (d <= 2) { printf("please enter the password\n"); scanf_s("%d", &password); printf("are you sure(1.

2021-09-27 19:40:08 474

原创 2021/9/27练手训练

#include<stdio.h> \\判定一个三角形是否为直角三角形#include<math.h>int main(){ int a = 0; int b = 0; int c = 0; printf("please enter the three length of sides\n"); scanf_s("%d", &a); scanf_s("%d", &c); scanf_s("%d", &b); if ((a * a) + .

2021-09-27 13:50:22 62

原创 2021/9/26自己写一个密码验证程序(未完成)

#include<stdio.h> //写一个密码验证程序#define Y 1#define N 0int main(){ int password[] = { 0 }; char a = 0; int b = 0, c = 0, d = 0, e = 0; int rpassword[1] = { 123456 }; while (b = 0, d <= 2) { printf("please enter the password\n"); scan.

2021-09-26 22:01:16 292

原创 2021/9/26 while循环的练手训练

char ch=0;while((ch=getchar())!=EOF){putchar(ch);}使用while循环的输入输出体系,getchar赋予的字符给变量,putchar给打印出来EOF代表着end of file,是文件结束标志,表示数值-1此时单纯输入EOF并不会打破循环,必须摁下ctrl加z,或者ctrl加c来终止运行...

2021-09-26 19:59:39 55

原创 2021-09-25练手训练

#include<stdio.h> //写一个判断一个数是否为奇数的代码int main(){ float num = 0; int a; printf("please enter a num\n"); scanf_s("%f", &num); num = num / 2; a = num; if (a == num) return 0; else return 1;}#include<stdio.h> //输出1-100之间所有奇数.

2021-09-25 17:11:37 51

原创 2021/9/25练手训练

对于if 的循环语句中#include<stdio.h>int main(){ int num = 0; printf("please enter a num"); scanf_s("%d", &num); if (num = 5) return 1; return 0;}对于此段代码而言,无论输入任何值,返回值都将为1,原因是单等号是赋值的意思不具有判定的意思需要改写为if(num==5)即可此外,可以将,num反写if(5==

2021-09-25 16:09:03 84

原创 2021/9/24对于if的分支语句

​#include<stdio.h>int main(){ int age = 0; printf("please enter your age(1<age<100)\n"); scanf_s("%d", &age); if (age < 18) printf("you are a teenager"); else if (18 <= age &&age<= 100) printf("you are a adult.

2021-09-24 21:50:48 37

原创 2021/9/23的结构体练习

#include<stdio.h> struct BOOK { char name[20]; short price = 20; };int main(){ struct BOOK b1 = { "HELLO WORLD",55 }; struct BOOK* p = &b1; printf("the name of book is %s, and the prince is %d\n", b1.name, b1.price); printf("%s", p.

2021-09-24 21:27:31 49

原创 2021/9/22练手训练(1)

一.三目操作符连续表达式应用或者对于简洁程序而言,可以使用(exp1?exp2:exp3)的程序代码完成,例如对于求两个数的较大值的代码中#include<stdio.h>int main(){ int a = 0; int b = 0; int max = 0; scanf_s("%d", &a); scanf_s("%d", &b); max = (a >= b?a: b); printf("the max num is %d", ma

2021-09-22 09:39:26 48

原创 关于写代码的一些简洁操作(个人向)

#include<stdio.h>int main(){ int a=2, b=4, c=6; int d = a + b + c; printf("%d", d); return 0;}利用设置变量类型type的的简易,可以写一个变量类型,然后后面跟着逗号接着写表示设立同类型变量,且在设立函数的时候可以直接对于变量套用公式,直接计算int main(){ int a=2, c=6; int e = MAX(a, c); printf("%d", e);}.

2021-09-22 09:02:00 73

原创 2021/9/21,复习训练

#include<stdio.h>int MAX(int a,int b){ if (a >= b) return a; else return b;}int ADD(int a,int b){ int add = 0; add = a + b; return add;}int main(){ int n = 0; int m = 0; int add = 0; int max = 0; printf("please enter the .

2021-09-21 19:40:27 57

原创 2021\08\14日学习c语训练

学习了一些关于c语言符号知识#define _CRT_SECURE_NO_WARINGS#include<stdio.h>int Max(int a, int b){ if (a > b) return a; else return b;}int main(){ int z = 0; int y = 0; int x = 0; printf("please enter two number\n"); scanf_s("%d%d", &y

2021-08-14 23:31:26 65

原创 2021-08-13练手训练

#define _CRT_SECURE_NO_WARINGS#include<stdio.h>int a = 1;int b = 1;int Max(int a,int b)//这里设置函数不需要加入分号{ if (a >= b)//if创建的讨论形式后不需要加分号 return a; else return b; return 0;}int main(){ int max = 0; printf("请输入两个数字\n"); scanf_s("%d.

2021-08-14 17:05:28 55

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除