C语言
LoveLibaobao
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C语言实现杨辉三角、冒泡排序
不啰嗦代码如下:杨辉三角#include<stdio.h>#include<stdlib.h>int main(){ int arr[10][10] = {}; for (int i = 0; i < 10; i++) { arr[i][0] = 1; } for (int row = 0; row < 10; row++) { for (int j = 0; j < row;原创 2020-09-16 11:33:23 · 332 阅读 · 0 评论 -
实现一个可以自由移动的字符 ‘A’(贪吃蛇基础)
思路用一个while循环不断接受按键消息1.获取控制台当前坐标 和方向2.根据坐标 方向画字符3. 按下w s a d 改变 方向代码如下:#include<stdio.h>#include<stdlib.h>#include <iostream>#include <Windows.h>#include <conio.h>void WriteChar(int x, int y, char* szInfo, int Color原创 2020-09-16 11:30:21 · 218 阅读 · 0 评论 -
sizeof和strlen和_countof的区别
sizeof和strlen和_countof的区别sizeof 计算占用内存strlen是函数,求字符的个数,不包括’/0’_countof是windows宏 计算数组的元素个数具体请看代码注释、配合运行结果理解#include<stdio.h>#include <iostream>using namespace std;int main(){ char arr[] = { "hello" }; int nNum1 = sizeof(arr);原创 2020-09-16 11:21:06 · 307 阅读 · 0 评论 -
用C语言实现大数相乘(笔记、转载【自哪忘记了】)
用C语言实现大数相乘大致思路:把两个大数字分别以数组的形式存储在变量中 如下int arr1[8] = { 1,2,3,4,5,6,7,8 };int arr2[8] = { 8,7,6,5,4,3,2,1 };然后像小学算法一样存储到新的数组中如图下:关键:这个时候你会发现在数组中的每个元素都是没有的进位的所以需要把每个元素超过10的部分进位源码如下:#include<stdio.h>int main(){ int arr1[8] = { 1,2,3,4,原创 2020-09-16 11:10:40 · 245 阅读 · 0 评论
分享