![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
代码
你不知道()
这个作者很懒,什么都没留下…
展开
-
乘法口诀表 润年等函数
高级乘法口诀表#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>void mul(int row,int col) {int x=0;printf(“请输入一个正整数:”);scanf("%d", &x);for (row = 1; row <= x; ++row) {for (col = 1; col &l...原创 2019-04-05 16:41:13 · 59 阅读 · 0 评论 -
杨氏矩阵
杨氏矩阵中查找一个数是否存在#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main() {int i = 0;scanf("%d", &i);int row = 0, col = 0;int arr[3][3] = { {1,2,3},{2,3,4},{3,4,5} };for (row = 0; r...原创 2019-04-22 22:32:38 · 114 阅读 · 0 评论 -
三子棋小游戏
先想好如何让电脑执行才能设计成功:1.菜单2.初始化棋盘(二维数组)3.打印棋盘4.玩家下棋5.判定胜负6.电脑下棋7.判定胜负#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#include<time.h>int Menu() {printf("\n"...原创 2019-04-23 22:15:43 · 119 阅读 · 0 评论 -
strcat strcpy的实现
strcpy#include <stdio.h>void strcpy(char* str1, char* str2) {int i = 0;while (1) {if (str2[i] != ‘\0’) {str1[i] = str2[i];++i;}else {break;}}}int main() {int arr1[] = { 0 };int a...原创 2019-04-28 17:22:58 · 156 阅读 · 0 评论 -
喝汽水问题
#include<stdio.h>void num(int x) {int d = 0, w = 0;int c = x;while (1) {if (x == 1) {printf("%d", c);break;}else if (x % 2 == 0) {x = x / 2;c += x;}else {x = (x - 1) / 2;c += x;x...原创 2019-04-28 17:47:37 · 92 阅读 · 0 评论 -
strcmp strstr memcpy的模拟实现
实现memcpy//从最后一个字符开始往前拷贝,可以解决内存重叠的部分问题void* Mymemcpy(void* dest, const void* src, size_t count) {assert(dest != NULL);assert(src != NULL);char* p = (char*)dest+(count-1);const charp1 = (char)src+...原创 2019-05-04 22:04:22 · 126 阅读 · 0 评论 -
扫雷小游戏
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>#define MAX_ROW 9#define MAX_COL 9#define MINE_COUNT 10 //菜单打印提醒玩家进行游戏选择;int Menu() {printf("\n");printf("...原创 2019-05-04 22:14:54 · 319 阅读 · 0 评论 -
malloccalloc realloc内存开辟
malloc动态开辟内存空间*函数声明:void malloc(unsigned size);#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>#include <string.h>//malloc 动态开辟内存空间int main() {char buf[2...原创 2019-05-04 22:18:10 · 129 阅读 · 0 评论 -
简易通讯录
用结构体相关内容来实现一个通讯录,通讯录中每个联系人信息包括:姓名、性别、年龄、电话、住址用一个结构体来完成描述的工作:功能如下:添加联系人信息 AddPersonInfo()删除指定联系人信息 DelPersonInfo()查找指定联系人信息 FindPersonInfo()修改指定联系人信息 UpdatePersonInfo()显示所有联系人信息 PrintAllPers...原创 2019-05-21 23:29:55 · 185 阅读 · 0 评论 -
奇前偶后
#include<stdio.h>#include<string.h>int main() {#define SIZE(arr) sizeof(arr)/sizeof(arr[0])int arr[] = { 1,2,4,6,8,9,11,27,55,12 };int i = 0, x = 0, y = 0;int arr1[128] = { 0 }, arr2...原创 2019-04-22 22:27:48 · 172 阅读 · 0 评论 -
字符串左旋以及查找一个字符串是否为另一个字符串旋转后得到
字符串左旋#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main() {int arr[4] = { “A”,“B”,“C”,“D” };int arr2[4] = { 0 };int k = 0;printf(“请输入一个整数:\n”);scanf("%d", &k);for (int i = 0; ...原创 2019-04-16 20:47:09 · 111 阅读 · 0 评论 -
求一个数组中最大值
#include<stdio.h>int main() {int arr[10] = { 1, 77, 31, 4, 500, 6, 7, 8, 9, 10 };int x=0;int i = arr[x];for (x = 0; x < 9; x++) {if (i>arr[x + 1]){;}else {i = arr[x + 1];}}pri...原创 2019-03-28 12:18:22 · 381 阅读 · 0 评论 -
求两个数的最大公约数
#include<stdio.h>int main() {int x = 168, y = 112; int i = x %y;for ( ; ; ) {if (i == 0) {printf("%d ", y);return 0;}else {x = y, y = i;i = x % y;}}return 0;}原创 2019-03-28 12:27:24 · 65 阅读 · 0 评论 -
猜数字游戏
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<time.h>int Meau() {printf("==\n");printf(“请输入您的选项\n”);printf(“1.开始游戏\n”);printf(“2.结束游戏\n”);printf("=\n");int choice = 0;...原创 2019-03-28 20:26:53 · 144 阅读 · 0 评论 -
折半查找法
#include<stdio.h>int main() {int arr[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };int to_find = 7;int left = 0, right = 9;while (left <= right) {int mid = (left + right) / 2;if (arr[mid] &l...原创 2019-03-28 20:30:19 · 129 阅读 · 0 评论 -
输密码
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int main() {int num, x=0,code=123456,Times=2;for (num = 1; num < 4; ++num) {printf(“请输入您的密码:\n”);scanf("%d", &x);if (x == code) {pr...原创 2019-03-28 20:31:45 · 225 阅读 · 0 评论 -
字符大小写转换
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>int main(){int num;printf(“请输入字符:\n”);scanf("%d", &num);while ((num = getchar()) != EOF){ if (num >= ‘a’&&num <= ‘z’)...原创 2019-03-28 20:32:45 · 167 阅读 · 0 评论 -
推理类代码
5位运动员参加了10米台跳水比赛,有人让他们预测比赛结果A选手说:B第二,我第三;B选手说:我第二,E第四;C选手说:我第一,D第二;D选手说:C最后,我第三;E选手说:我第四,A第一;比赛结束后,每位选手都说对了一半#include<stdio.h>int main() {int a = 0, b = 0, c = 0, d = 0, e = 0;for (a =...原创 2019-04-12 20:36:33 · 538 阅读 · 0 评论 -
杨辉三角
#include<stdio.h>int main() {int row=0, col=0;int arr[20][20] = { 0 };arr[0][0] = 1;printf("%d\n",arr[0][0]);for (row = 1; row < 10; ++row) {arr[row][0] = 1;printf("%d “, arr[row][0])...原创 2019-04-12 20:38:19 · 103 阅读 · 0 评论 -
查看万天纪念日
#include<stdio.h>void Date(int _year, int _month, int _day) {for (int i = 1; i <= 10000; i++) {_day = _day + 1;if ((_month == 1 || _month == 3 || _month == 5 || _month == 7 || _month == 8...原创 2019-07-22 17:18:53 · 389 阅读 · 0 评论