- 博客(13)
- 收藏
- 关注
原创 C++冒泡排序法
#include<iostream>using namespace std;int main(){ int arr[] = { 4,2,8,0,5,7,1,3,9 }; cout << "排序前" << endl; for (int i = 0; i < 9; i++) { cout << arr[i]<<" "; } for (int i = 0; i < 9 - 1; i++) { for (int j.
2022-05-21 14:50:33
157
原创 数组逆置c++
#include<iostream>using namespace std;int main(){ int arr[] = { 1,2,3,4,5,6,7,8,9,10 }; cout << "数组拟置前:" << endl; for (int i = 0; i<10;i++) { cout << arr[i] << endl; } int start = 0; int end = sizeof(arr) / siz.
2022-05-20 21:25:31
159
原创 数组最大值查找
#include<iostream>using namespace std;int main(){ int arr[] = { 100,330,542,330,985,201,257,852,621,660 }; int max = 0; for (int; i < 10; i++) { if (arr[i] > max) { max = arr[i]; } } cout << max << endl;}
2022-05-20 20:56:45
90
原创 【点阵显示汉字“王”】C++
#include<iostream>using namespace std;int main(){ int a, i, n, j; char S; cout << "以多大的点阵显示汉字,16*16输入16,32*32输入32,以此类推?" << endl; cin >> a; cout << "请问构成汉字的基本字符号是什么?" << endl; cin >> S; i = n = j = 1.
2022-04-23 19:51:00
1728
原创 【数据的输入】
#include<iostream>using namespace std;#include<string>int main(){ //1、整形 int a = 0; cout << "请给整形变量a赋值:" << endl; cin >> a; cout << "整形变量a=" << a << endl; //2、浮点型 float f = 3.14;...
2022-04-22 16:23:34
300
原创 【bool数据类型】
#include<iostream>using namespace std;int main(){ //1.创建boll数据类型 bool flag = true; //true代表真 cout << flag << endl; flag = false; cout << flag << endl; cout << "bool字符数所占空间:" << sizeof(flag)...
2022-04-22 16:01:29
407
原创 【字符串】
#include<iostream>using namespace std;#include<string>//用C++风格字符串时候要包含这个头文件int main(){ //1.C风格字符串 //注意事项 char 字符串名 [] //注意事项 等号后面双引号 包含起来字符串 cout << "hello world" << endl; char str1[] = "hello world"; cout << str1 .
2022-04-22 15:51:08
605
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人