- 博客(4)
- 收藏
- 关注
原创 通过传值和传地址输出结构体中的内容
#include #include<string.h>#include <stdio.h>using namespace std;struct student {string name;int age;string sex;};void byValue(struct student s1){ cout << "通过传值输出结构体中的数据:" << endl; cout << "姓名为:" << s1.n
2021-04-05 17:40:40
169
原创 c++利用冒泡算法对结构体进行升序排列
#include#includeusing namespace std;struct hero {string name;int age;string sex;};//对结构体进行冒泡排序的函数void bubbleSort(struct hero heroArray[], int len){for (int i = 0; i < len-1; i++){ for (int j = 0; j < len - i - 1; j++) { if (heroArra
2021-04-05 15:52:17
224
原创 c++ 结构体 3名教师 5名学生信息
#include #include <string.h>#include<time.h>using namespace std;struct student {string sname;int score;};struct teacher {string tname; struct student sarry[5];};void allocatespace(struct teacher tarray[], int len){//名字种子string
2021-04-04 21:47:39
416
原创 c++输入一个一维数组进行冒泡排序
#include<string.h>#include#include<stdio.h>using namespace std;int main(){int i = 0; int j = 0;int n;cout << “请输入你定义的数组长度:” << endl;cin >>n;int *arr = new int[n]; // 指针指向首地址cout << "请输入数组中元素:" << endl;
2021-04-04 14:47:43
1032
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人