随笔 - 322  文章 - 0  评论 - 4  阅读 - 77146

随笔分类 -  C语言基础知识.

上一页 1 2 3 4 下一页
----分享C的知识!
数组逆序
摘要:1 //数组逆序 2 3 #include <stdio.h> 4 #define N 5 5 int main() 6 { 7 int array[N] = {21,69,85,55,89}; 8 int i; 9 int temp; 10 11 12 //for(i = 0; i< N /2; 阅读全文
posted @ 2021-07-28 11:09 Bytezero! 阅读(175) 评论(0) 推荐(0) 编辑
二维数组指针打印
摘要:1 #include <stdio.h> 2 int main() 3 { 4 5 int nums[5][3] = {{10,20,30},{40,50,60},{70,80,90},{100,110,120},{130,140,150}}; 6 int i,j; 7 8 9 // int (*p 阅读全文
posted @ 2021-07-28 11:05 Bytezero! 阅读(109) 评论(0) 推荐(0) 编辑
数字转换大写的中文
摘要:1 #include <stdio.h> 2 int main() 3 { 4 5 int moneys[6]; 6 char unit[10][4] ={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"}; 7 int i =0; 8 int money,count 阅读全文
posted @ 2021-07-28 11:00 Bytezero! 阅读(53) 评论(0) 推荐(0) 编辑
C中的内置函数
摘要:1 //#include <stdio.h> 2 //#include <ctype.h> 3 //#include <math.h> 4 //#include <stdlib.h> 5 //#include <time.h> 6 7 //int main() 8 //{ 9 10 /* 11 // 阅读全文
posted @ 2021-07-28 10:55 Bytezero! 阅读(156) 评论(0) 推荐(0) 编辑
函数调用
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 //圆的面积 5 void calcCircle(); 6 //矩形的面积 7 void calcRectangle(); 8 //求1-100之间的偶数和 9 int 阅读全文
posted @ 2021-07-28 10:50 Bytezero! 阅读(47) 评论(0) 推荐(0) 编辑
函数查找
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 5 6 int search(); 7 8 9 int main() 10 { 11 12 13 int index = search(); 14 printf("找到的元素的下标是:%d\n",index 阅读全文
posted @ 2021-07-28 10:45 Bytezero! 阅读(37) 评论(0) 推荐(0) 编辑
实现 pow 函数
摘要:1 ////实现pow函数 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 double power(double,int) ; //函数原型 6 int main() 7 8 { 9 10 printf("%d的%d次幂等于: %.2lf\n",5,2 阅读全文
posted @ 2021-07-28 10:35 Bytezero! 阅读(190) 评论(0) 推荐(0) 编辑
C函数调用(2)
摘要:1 //函数调用 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <math.h> 6 //根据传入的半径,返回圆的面积 7 double calcCircle(double); 8 9 //要对用户输入进行非负的判断 10 int v 阅读全文
posted @ 2021-07-28 10:35 Bytezero! 阅读(34) 评论(0) 推荐(0) 编辑
C 递归
摘要:递归指的是在函数的定义中使用函数自身的方法。 举个例子:从前有座山,山里有座庙,庙里有个老和尚,正在给小和尚讲故事呢!故事是什么呢?"从前有座山,山里有座庙,庙里有个老和尚,正在给小和尚讲故事呢!故事是什么呢?'从前有座山,山里有座庙,庙里有个老和尚,正在给小和尚讲故事呢!故事是什么呢?……'" 例 阅读全文
posted @ 2021-07-28 10:15 Bytezero! 阅读(38) 评论(0) 推荐(0) 编辑
C作用域
摘要:任何一种编程中,作用域是程序中定义的变量所存在的区域,超过该区域变量就不能被访问。C 语言中有三个地方可以声明变量: 在函数或块内部的局部变量 在所有函数外部的全局变量 在形式参数的函数参数定义中 局部变量 在某个函数或块的内部声明的变量称为局部变量。它们只能被该函数或该代码块内部的语句使用。局部变 阅读全文
posted @ 2021-07-28 10:05 Bytezero! 阅读(151) 评论(0) 推荐(0) 编辑
查看调用了多少次
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 int whileCount = 0; //全局变量,用来记while循环执行的轮数 5 //作用域只在当前的源文件 6 //extern int whileCount; //可以在其他源文件 引用 外部变 阅读全文
posted @ 2021-07-28 10:00 Bytezero! 阅读(134) 评论(0) 推荐(0) 编辑
引用传递 传的地址
摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 4 //引用传递 传的地址 5 void change(int *); 6 7 void change(int *num) 8 { 9 *num +=1; 10 } 11 12 int main() 13 { 阅读全文
posted @ 2021-07-28 09:55 Bytezero! 阅读(44) 评论(0) 推荐(0) 编辑
书写一个小型的学生成绩管理系统
摘要:1 //书写一个小型的学生成绩管理系统 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 #define N 5 6 //书写一个小型的学生成绩管理系统 7 void input(double []); 8 void sort(double []); 9 阅读全文
posted @ 2021-07-28 09:50 Bytezero! 阅读(91) 评论(0) 推荐(0) 编辑
自定义字符串的几种方式
摘要:1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 //字符串和字符数组的区别:最后一位是否是 \0,空字符 有的为 字符串 没有的 为字数组 6 //所有的字符串都是字符数组 对的 7 //所有的字符数组都是字符串 错的. 8 / 阅读全文
posted @ 2021-07-28 09:40 Bytezero! 阅读(394) 评论(0) 推荐(0) 编辑
返回传入字符串的长度
摘要:1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 //返回传入字符串的长度 6 int GetStrLength(char[]); 7 8 //封装fgets<用来接收字符串的字符数组,接收的字符总数 9 void G 阅读全文
posted @ 2021-07-28 09:32 Bytezero! 阅读(138) 评论(0) 推荐(0) 编辑
内置函数 strlen
摘要:1 //内置函数 strlen 2 //计算字符串的实际长度,不含字符串结束标准\0 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 void main() 9 { 10 11 char words1[] = { 阅读全文
posted @ 2021-07-28 09:30 Bytezero! 阅读(57) 评论(0) 推荐(0) 编辑
内置函数 字符串的复制 strcpy
摘要:1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 5 6 void main() 7 { 8 9 char str1[50]; 10 char str2[20]; 11 printf("输入目的字符串:"); 12 get 阅读全文
posted @ 2021-07-28 09:25 Bytezero! 阅读(49) 评论(0) 推荐(0) 编辑
内置函数 字符串比较 strcmp 登录密码
摘要:1 //内置函数 字符串比较 strcmp 2 // 原理:将两个字符串从首字母开始,按照ASCII码的顺序逐个比较 3 //字符串1 == 字符串2 返回0 4 //字符串1 < 字符串2, 返回正数 5 //字符串1 > 字符串2 ,返回负数 6 7 #include<stdio.h> 8 #i 阅读全文
posted @ 2021-07-28 09:20 Bytezero! 阅读(151) 评论(0) 推荐(0) 编辑
字符串连接 strcat
摘要:1 //字符串连接 strcat 2 //将一个字符串连接到另一个字符串的末尾,组合成一个新字符串 3 4 #include<stdio.h> 5 #include<stdlib.h> 6 #include<string.h> 7 8 void main() 9 { 10 char str1[200 阅读全文
posted @ 2021-07-28 09:10 Bytezero! 阅读(128) 评论(0) 推荐(0) 编辑
实现字符串的加密与解密
摘要://实现字符串的加密与解密//加密方式:将字符串中每个字符加上它在字符中的位置和一个偏移量 5//列如:zhnglie中,第一个字符z在字符中的位置为0,那么对应密文是'm'+0+5 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string 阅读全文
posted @ 2021-07-28 09:00 Bytezero! 阅读(1171) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 下一页
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示