摘要: 1 #include <iostream> 2 using namespace std; 3 int main() { 4 //一维数组练习 5 //五只小猪称体重 例:int arr[5]={300,350,200,400,250}; 6 //找出最重打印 访问数组中每个元素,如果比我认定的最大值 阅读全文
posted @ 2022-03-13 14:13 赵凤武 阅读(65) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 using namespace std; 3 int main() { 4 //一维数组组名 数组名是常量 不能赋值 5 //1.统计整个数组在内存长度 6 //2.可以获取数组在内存中的首地址 7 int arr[10]={1,2,3,4,5,6,7 阅读全文
posted @ 2022-03-13 13:44 赵凤武 阅读(61) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 using namespace std; 3 int main() { 4 //goto语句 5 //跳过中间的语句 6 cout<<"1"<<endl; 7 goto FLAG; 8 cout<<"2"<<endl; 9 cout<<"3"<<end 阅读全文
posted @ 2022-03-13 13:27 赵凤武 阅读(36) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //continue语句 //跳出本次循环 执行下次循环 for(int i=0;i<=10;i++) { //奇数输出偶数不输出 if(i % 2 == 0) { continue; } c 阅读全文
posted @ 2022-03-12 22:46 赵凤武 阅读(94) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 using namespace std; 3 int main() { 4 //break使用时机 5 //1.出现在switch中 6 cout<<"请选择副本难度"<<endl; 7 cout<<"1.普通"<<endl; 8 cout<<"2.中 阅读全文
posted @ 2022-03-12 22:40 赵凤武 阅读(47) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 using namespace std; 3 int main() { 4 //9X9 乘法口诀表 //列小于等于行数 5 // 1*1 6 // 1*2 2*2 7 // 1*3 2*3 3*3 8 for(int i=1;i<10;i++) 9 { 阅读全文
posted @ 2022-03-12 22:27 赵凤武 阅读(93) 评论(0) 推荐(0)
摘要: 1 #include <iostream> 2 using namespace std; 3 int main() { 4 //敲桌子 逢7 打印敲桌子 5 for(int i=1;i<=100;i++) 6 { 7 if(i%7==0) //7的倍数 8 { 9 cout<<i<<endl; 10 阅读全文
posted @ 2022-03-12 22:16 赵凤武 阅读(104) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //三位水仙花数 例 1^3+5^3+3^3 = 153 int num=100; do{ int a=0,b=0,c=0; a = num % 10; //获取个位 b = num /10 阅读全文
posted @ 2022-03-12 22:05 赵凤武 阅读(63) 评论(0) 推荐(0)
摘要: #include <iostream> #include <ctime> using namespace std; int main() { //猜数字1-100 //添加随机种子 srand((unsigned int)time(NULL)); int number = rand() % 100; 阅读全文
posted @ 2022-03-12 21:51 赵凤武 阅读(32) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { int a=10,b=20,c=0; c = (a>b?a:b); //a>b返回a 否则b cout<<c<<endl; (a>b?a:b) = 100; cout<<"a="<<a<<en 阅读全文
posted @ 2022-03-12 21:49 赵凤武 阅读(13) 评论(0) 推荐(0)