摘要: #include<iostream> using namespace std; #include<string> #include<ctime> int main() { //敲桌子 int i ; for (i = 1; i <= 100; i++) { if (i % 10 == 7 || i 阅读全文
posted @ 2020-02-29 13:26 Jackie_Wang 阅读(321) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<string> #include<ctime> int main() { //找出100~999中的水仙花数 int num = 100; do { int a = 0; int b = 0; int 阅读全文
posted @ 2020-02-29 13:14 Jackie_Wang 阅读(3069) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<string> #include<ctime> int main() { //添加随机数种子,作用利用当前系统时间生成随机数,防止每次随机数都一样 srand((unsigned int)time(NU 阅读全文
posted @ 2020-02-28 18:17 Jackie_Wang 阅读(712) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<string> int main() { //多元分支 cout << "请输入学生的分数:" << endl; int score; cin >> score; cout << "您输入学生的分数为: 阅读全文
posted @ 2020-02-28 09:42 Jackie_Wang 阅读(329) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<string> int main() { //三目运算符 int a = 10; int b = 20; int c = 0; c = (a > b ? a : b); cout << "c=" << 阅读全文
posted @ 2020-02-28 09:21 Jackie_Wang 阅读(1492) 评论(0) 推荐(0) 编辑
摘要: 三只小 #include<iostream> using namespace std; #include<string> int main() { //which pig is the biggest int num1 = 0; int num2 = 0; int num3 = 0; cout << 阅读全文
posted @ 2020-02-27 23:28 Jackie_Wang 阅读(635) 评论(0) 推荐(0) 编辑
摘要: if(判断条件){执行语句} #include<iostream> using namespace std; #include<string> int main() { int score = 0; cout << "Input your score,please :" << endl; cin > 阅读全文
posted @ 2020-02-27 23:06 Jackie_Wang 阅读(493) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<string> int main() { string str = "hello world!"; cout << str << endl; cin >> str; cout << str << end 阅读全文
posted @ 2020-02-25 09:14 Jackie_Wang 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; #include<string> int main() { //创建bool数据类型 bool flag = true; cout << flag << endl; flag = false; cout << flag 阅读全文
posted @ 2020-02-25 08:57 Jackie_Wang 阅读(330) 评论(0) 推荐(0) 编辑
摘要: C风格字符串:char 变量名[ ]="字符串值 " int main() { char str[] = "hello world!"; cout << str << endl; system("pause"); return 0; } 2. C++风格的字符串:string 变量名 = “字符串值 阅读全文
posted @ 2020-02-25 08:50 Jackie_Wang 阅读(202) 评论(0) 推荐(0) 编辑