帮做网站的网站,疗养院有必要做网站吗,东莞网站建设美丽,网站建设公司哪家好?while循环语句 在屏幕中打印0~9这十个数字 #include iostream
using namespace std;int main() {int i  0;while (i  10) {cout  i  endl;i;}system(pause);return 0;
} 练习案例: 猜数字 案例描述:系统随机生成一个1到100之间的数字iostream
using namespace std;int main() {int i  0;while (i  10) {cout  i  endl;i;}system(pause);return 0;
}    练习案例: 猜数字  案例描述:系统随机生成一个1到100之间的数字玩家进行猜测如果猜错提示玩家数字过大或过小如果猜对恭喜玩家胜利并且退出游戏。 #include iostream
using namespace std;
#include ctimeint main() {srand((unsigned int)time(NULL));int num  rand() % 100  1;int num2  0;cout  请输入数字  endl;while (1) {cin  num2;if (num  num2) {cout  猜小了  endl;}else if (num  num2) {cout  猜大了  endl;}else {cout  猜对了  endl;break;}}system(pause);return 0;
}     do……while循环语句  在屏幕中打印0~9这十个数字 #include iostream
using namespace std;int main() {int num  0;do {cout  num  endl;num;} while (num  10);system(pause);return 0;
}    练习案例: 水仙花数  案例描述: 水仙花数是指一个 3 位数它的每个位上的数字的 3次幕之和等于它本身 例如: 1^3  5^3 3^3  153 请利用do...while语句求出所有3位数中的水仙花数  #include iostream
using namespace std;int main() {int i  100;do {int x1i / 100;int x2  i / 10 % 10;int x3i % 10;if (x1 * x1 * x1  x2 * x2 * x2  x3 * x3 * x3  i) {cout  i  endl;}i;} while (i  1000);system(pause);return 0;
}    for循环  在屏幕中打印0~9这十个数字 #include iostream
using namespace std;int main() {for (int i  0; i  10; i) {cout  i  endl;}system(pause);return 0;
}    练习案例:敲桌子  案例描述:从1开始数到数字100如果数字个位含有7或者数字十位含有7或者该数字是7的倍数我们打印敲桌子其余数字直接打印输出。 #include iostream
using namespace std;int main() {for (int i  0; i  100; i) {if (i % 10  7 || i / 10  7 || i % 7  0) {cout  拍桌子  endl;}else {cout  i  endl;}}system(pause);return 0;
}    嵌套循环 打印10*10方正 #include iostream
using namespace std;int main() {for (int i  0; i  10; i) {for (int j  0; j  10; j) {cout  * ;}cout  endl;}system(pause);return 0;
}    乘法口诀表  #include iostream
using namespace std;int main() {for (int i  1; i  9; i) {for (int j  1; j  i; j) {cout  j  *  i   i * j  ;}cout  endl;}system(pause);return 0;
}