- 博客(6)
- 问答 (1)
- 收藏
- 关注
原创 C++学习之指针数组函数 冒泡排序
指针数组函数利用指针数组函数 结合冒泡排序来对一个数组里面的数进行排序//冒泡排序#include<iostream>using namespace std;void Bibblesort(int* arr, int len)//数组首地址,长度{ for (int i = 0; i < len - 1; i++) { for (int j = 0; j < len - 1 - i; j++) { if (arr[j] > arr[j + 1])
2020-06-18 16:22:09 643
原创 C++学习之一维数组 冒泡排序
冒泡排序#include<iostream>using namespace std;int main(){ //冒泡排序 int arr[9] = { 2,4,7,5,3,6,9,0,1 }; for (int i = 0; i < 8; i++)//总排序数 { for (int j = 0; j < 8 - i; j++)//对比次数 { if (arr[j] > arr[j + 1]) { int temp = arr[j];
2020-06-17 19:57:14 486
原创 C++学习之嵌套循环 打印乘法口诀表
打印乘法口诀表//#include<iostream>using namespace std;int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j <= i; j++) { cout << j << "*" << i << "=" << i * j << "\t"; } cout << endl;
2020-06-17 16:52:27 310
原创 C++学习之for循环 敲桌子
敲桌子从1开始到100,如果数字中个位或十位含有7,或者是7的倍数,我们打印敲桌子,其他数字直接输出。//敲桌子#include<iostream>using namespace std;int main(){ for (int a = 1; a <= 100; a++) { if (a % 7 == 0 || a % 10 == 7 || a / 10 == 7) { cout << "敲桌子" << endl; } else
2020-06-17 16:06:10 309 1
原创 C++学习 之do...while循环 水仙花数字
水仙花数字水仙花数是指一个三位数,它的每个位上的数字的三次幂之和等于它本身。#include<iostream>using namespace std;int main(){ int x = 100; do { int a, b, c; a= x % 10; //个位 b= x / 10 % 10;//十位 c= x / 100; //百位
2020-06-17 15:47:32 2690
原创 C++学习之while循环 猜数字小游戏
规则介绍系统随机生成一个1~100的数字,玩家输入答案,每次提示过大还是过小,如果五次还没猜出来,则为失败。以下为源代码#include<iostream>using namespace std;#include<ctime>int main(){ srand((unsigned int)time(NULL)); int num = rand() % 100 + 1; int a; int x = 0; while (x < 5) { cin &
2020-06-17 00:10:06 1035
空空如也
Vs2019中拖arcgis windows form组件无响应然后自动关闭程序的原因
2021-05-26
TA创建的收藏夹 TA关注的收藏夹
TA关注的人