摘要: #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 阅读(108) 评论(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)
摘要: #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 阅读(57) 评论(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 阅读(105) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;int main(){ //程序流程结构:顺序结构 选择结构 循环结构 //1 选择结构 //1-1单行if语句 if(){} //1-2多行if语句 if(){}... 阅读全文
posted @ 2021-03-10 13:29 yub4by 阅读(75) 评论(0) 推荐(0)
摘要: #include#includeusing namespace std;int main(){ /* 二维数组的数组名 查看二维数组所占内存空间 获取二维数组首地址 */ // 1 int ar... 阅读全文
posted @ 2021-03-10 13:28 yub4by 阅读(55) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){ /* 算法--冒泡排序(实现升序) 比较相邻元素,若第一个>第二个,则交换 对每一组相邻元素执行上句操作,完成后,找到第一个最大值 ... 阅读全文
posted @ 2021-03-10 13:28 yub4by 阅读(244) 评论(0) 推荐(0)
摘要: #includeusing namespace std;int main(){ /* 数组特点: 放在一块连续内存空间中 数组中每个元素的数据类型相同 下标从0开始索引 */ //数组定... 阅读全文
posted @ 2021-03-10 13:27 yub4by 阅读(53) 评论(0) 推荐(0)
摘要: #includeusing namespace std;/* 函数的声明,作用是提前告诉编译器函数的存在 函数声明可以有多次(但一般写一次就行),函数定义只能有一次*///函数声明int get_max_1(int a, int b);//函数定义... 阅读全文
posted @ 2021-03-09 20:52 yub4by 阅读(25) 评论(0) 推荐(0)
摘要: #includeusing namespace std;/* 常见函数样式: 无参无返 有参无返 无参有返 无参无返*/// 1void test1(){ cout << "this is test1" << endl;}/... 阅读全文
posted @ 2021-03-09 20:51 yub4by 阅读(30) 评论(0) 推荐(0)