摘要: #include <iostream> using namespace std; int main() { int i; for (i = 1; i ⇐ 20; i++) { if (i % 3 == 0)//能被 3 整除的整数,返回进行下次循环 continue; cout << i << en 阅读全文
posted @ 2021-07-05 10:27 江南王小帅 阅读(130) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //累加键盘输入的数据 double x, sum = 0.0; while (1) { cout << "x="; cin >> x; if (x <= 0) break; sum += x 阅读全文
posted @ 2021-07-05 10:22 江南王小帅 阅读(213) 评论(0) 推荐(0)
摘要: #include using namespace std; int main() { int x, sum = 0; //定义标号L1 L1: cout << "x="; cin >> x; if (x == -1) goto L2;//无条件转移语句,转到L2语句处 else sum += x; 阅读全文
posted @ 2021-07-05 10:16 江南王小帅 阅读(652) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { for (int i = 1; i ⇐ 9; i++) { //cout << i; for (int j = 1; j ⇐ 9; j++) cout << '\t' << i << "*" 阅读全文
posted @ 2021-07-05 10:05 江南王小帅 阅读(47) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //计算s=1+2+3...+100 int s = 0; int n = 0; do { n++; s += n; } while (n <= 100); cout << "s = " << 阅读全文
posted @ 2021-07-05 09:52 江南王小帅 阅读(575) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //计算s=1+2+3...+100 int s = 0, n = 1; while (n ⇐ 100) { s += n; n++; } cout << "s=" << s << endl; 阅读全文
posted @ 2021-07-05 09:46 江南王小帅 阅读(257) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //显示1,2,3...10 for (int i = 1; i ⇐ 10; i++) cout << i << endl; //显示10,9,8...1 for (int i = 10; i 阅读全文
posted @ 2021-07-05 09:32 江南王小帅 阅读(45) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; float x = 365.5; //声明全局变量; int main() { int x = 1, y = 2; double w = x + y; { double x = 1.121, y = 1.362, z 阅读全文
posted @ 2021-07-05 09:19 江南王小帅 阅读(26) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { //x,y 为操作数,c为运算符 int x, y, z; char c1; cin >> x >> c1 >> y; //多路选择语句选择不同表达式计算语句 switch (c1) { ca 阅读全文
posted @ 2021-07-05 08:59 江南王小帅 阅读(62) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { int a, b, MAX; cout << "a = " ; cin >> a ; cout << "b = " ; cin >> b; MAX = a > b ? a : b; cout 阅读全文
posted @ 2021-07-01 15:36 江南王小帅 阅读(43) 评论(0) 推荐(0)