摘要: #include#include#includeusing namespace std;#define MAX 1000struct Person{ string name; int sex; // 1男2女 int age; stri... 阅读全文
posted @ 2021-03-11 19:53 yub4by 阅读(28) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体-案例#2 三国英雄:5名英雄,通过冒泡排序按照年龄升序排列*/struct Hero{ string name; int age; string... 阅读全文
posted @ 2021-03-11 12:05 yub4by 阅读(40) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体中const的使用场景 用const来防止误操作*/struct student{ string name; int age; int score... 阅读全文
posted @ 2021-03-11 12:05 yub4by 阅读(108) 评论(0) 推荐(0)
摘要: #include#include#include //随机数用到#include //时间用到using namespace std;/* 结构体-案例#1 三个老师,每个老师带五个学生做毕设*/struct student{ strin... 阅读全文
posted @ 2021-03-11 12:05 yub4by 阅读(44) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体做函数参数 值传递&地址传递*/struct student{ string name; int age; int score;};voi... 阅读全文
posted @ 2021-03-11 12:05 yub4by 阅读(91) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体指针 可以通过操作符'->'访问结构体中的成员(属性)*/struct Student{ string name; int age; int sc... 阅读全文
posted @ 2021-03-11 12:04 yub4by 阅读(26) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体嵌套结构体*/struct student{ string name; int age; int score;};struct teacher{ ... 阅读全文
posted @ 2021-03-11 12:04 yub4by 阅读(64) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体数组 将自定义的结构体放入数组中 方便维护*/struct Student{ string name; int age; int score;};... 阅读全文
posted @ 2021-03-11 12:03 yub4by 阅读(53) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体 一些数据类型的集合 用户自定义的数据类型 允许存放不同的数据类型*/// 结构体定义struct Student{ string name; ... 阅读全文
posted @ 2021-03-10 18:46 yub4by 阅读(23) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){ //2 循环结构 //2-3 for(起始表达式0;条件表达式1;末尾循环体2){循环语句3} //起始表达式仅执行1次;执行顺序:0 123 123 123 .... 阅读全文
posted @ 2021-03-10 13:30 yub4by 阅读(92) 评论(0) 推荐(0)