摘要: #include#includeusing namespace std;/* 结构体中const的使用场景 用const来防止误操作*/struct student{ string name; int age; int score... 阅读全文
posted @ 2021-03-11 12:05 yub4by 阅读(122) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体嵌套结构体*/struct student{ string name; int age; int score;};struct teacher{ ... 阅读全文
posted @ 2021-03-11 12:04 yub4by 阅读(78) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体指针 可以通过操作符'->'访问结构体中的成员(属性)*/struct Student{ string name; int age; int sc... 阅读全文
posted @ 2021-03-11 12:04 yub4by 阅读(27) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体数组 将自定义的结构体放入数组中 方便维护*/struct Student{ string name; int age; int score;};... 阅读全文
posted @ 2021-03-11 12:03 yub4by 阅读(81) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;/* 结构体 一些数据类型的集合 用户自定义的数据类型 允许存放不同的数据类型*/// 结构体定义struct Student{ string name; ... 阅读全文
posted @ 2021-03-10 18:46 yub4by 阅读(35) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){ //2 循环结构 //2-4 嵌套循环 for (int i=0; i 列数> select; switch (select){ case 1: ... 阅读全文
posted @ 2021-03-10 13:30 yub4by 阅读(115) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){ //3 跳转语句 //3-2 continue //循环语句中,跳过本次循环中余下未执行的语句,直接执行下一次循环 //区别:break会直接退出循环而不再... 阅读全文
posted @ 2021-03-10 13:30 yub4by 阅读(74) 评论(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 阅读(118) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){ //2 循环结构 //2-2 do-while int num = 0; do{ cout << num << endl; nu... 阅读全文
posted @ 2021-03-10 13:29 yub4by 阅读(64) 评论(0) 推荐(0)
摘要: #include#include#include //随机数用到#include //时间用到using namespace std;int main(){ //2 循环结构 //2-1 while int num = 0; whi... 阅读全文
posted @ 2021-03-10 13:29 yub4by 阅读(121) 评论(0) 推荐(0)