摘要: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { int n; do { cin>>n; } while(n==1);//条件为FALSE时,执行后面的语句 { co 阅读全文
posted @ 2020-05-21 11:12 财盛 阅读(541) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "string" using namespace std; void count();//函数原形 int main() { count(); } void count() { string a="ab 阅读全文
posted @ 2020-05-21 11:11 财盛 阅读(193) 评论(0) 推荐(0)
摘要: 2018年初赛奥赛题(8分): 代码: #include "stdafx.h" #include <cstdio> int main() { int x; scanf_s("%d",&x); int res=0; for(int i=0;i<x;++i) { if (i*i%x==1) {++res 阅读全文
posted @ 2020-05-21 11:09 财盛 阅读(247) 评论(0) 推荐(0)
摘要: 2018年初赛奥赛题(8分): 代码: #include "stdafx.h" #include <cstdio> char st[100]; int main() { cin>>st; for(int i=0;st[i];++i) { if('A'<=st[i] && st[i]<='Z') st 阅读全文
posted @ 2020-05-21 10:56 财盛 阅读(501) 评论(0) 推荐(0)
摘要: 2018初赛奥赛题(5分): 甲乙丙丁四人在考虑周末要不要外出郊游。已知1、如果周末下雨,并且乙不去,则甲一定不去;2、如果乙去,则丁一定去;3、如果丙去,则丁一定不去;4、如果丁不去,而且甲不去,则丙一定不去。如果周末丙去了,则甲 (去了/没去),乙 (去了/没去),丁 (去了/没去),周末 (下 阅读全文
posted @ 2020-05-21 10:54 财盛 阅读(682) 评论(0) 推荐(0)
摘要: 题目1: 输入一个介于0-100之间的整数,求其中含几个5? 思路: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int main() { int 阅读全文
posted @ 2020-05-21 10:52 财盛 阅读(273) 评论(0) 推荐(0)
摘要: 题目: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int a; int box; int main() { int n,s=0; cin>>n; 阅读全文
posted @ 2020-05-21 10:38 财盛 阅读(97) 评论(0) 推荐(0)
摘要: 2018奥赛初赛题(5) 题目: 从1到2018这2018个数中,共有 544 个包含数字8的数。含数字8的数是指某一位是“8”的数,例如“2018”与“188。” 解题思路: A方案: 将这2018个数字分别变成字符串,然后在每个字符串中,用find()方法找"8"(即看这个数是否含有"8",找到 阅读全文
posted @ 2020-05-21 10:28 财盛 阅读(1084) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { int line=0; char ch; while (cin.get(ch)) { if(ch=='Q'){bre 阅读全文
posted @ 2020-05-21 10:20 财盛 阅读(102) 评论(0) 推荐(0)
摘要: 要求:对70开方,保留到小数后1位。 #include "stdafx.h" #include "iostream" #include "string"#include "iomanip" using namespace std; int main() { int a=70; double b=0; 阅读全文
posted @ 2020-05-21 10:18 财盛 阅读(277) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cmath" using namespace std; struct polar {double distance;double angle;}; struct rect {double x;doub 阅读全文
posted @ 2020-05-21 10:16 财盛 阅读(155) 评论(0) 推荐(0)
摘要: 代码部分: #include "stdafx.h" #include "iostream" struct travel_time {int hours;int mins;}; const int Mins_per_hr=60; travel_time sum( travel_time t1,trav 阅读全文
posted @ 2020-05-21 10:14 财盛 阅读(163) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-05-21 10:04 财盛 阅读(237) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { string pwd="a123"; string n=""; int j=1; do { cout<<"请第"<< 阅读全文
posted @ 2020-05-21 08:45 财盛 阅读(673) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "cstdio" #include "iostream" #include "algorithm" using namespace std; int main() { char grade='A'; switch(grade) { case 阅读全文
posted @ 2020-05-21 08:44 财盛 阅读(337) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "cstdio" #include "iostream" #include "algorithm" using namespace std; int main() { string grade="A"; if (grade=="A") cou 阅读全文
posted @ 2020-05-21 08:43 财盛 阅读(542) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int a,b,c,d; int main() {for (c=0;c>=0;c++) //此处可用替换 阅读全文
posted @ 2020-05-21 08:35 财盛 阅读(1802) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int a,b,c,d,e,f; int main() {cin>>a; cin>>b; cin>>c; 阅读全文
posted @ 2020-05-21 08:34 财盛 阅读(150) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" void oil(int x); using namespace std; int main() { int texas=31; int year 阅读全文
posted @ 2020-05-21 08:32 财盛 阅读(132) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; struct job { char name[40]; double salary; int floor 阅读全文
posted @ 2020-05-21 08:26 财盛 阅读(133) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; template <typename T> void swap1(T &a,T &b);//引用变量 t 阅读全文
posted @ 2020-05-21 08:25 财盛 阅读(134) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; template <class T> //或者template <typename T>注意没有分号 v 阅读全文
posted @ 2020-05-21 08:16 财盛 阅读(106) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; unsigned long left(unsigned long num,unsigned ct); c 阅读全文
posted @ 2020-05-21 08:15 财盛 阅读(172) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "iostream" #include "cstring" #include "string" using namespace std; int main() { //第一组代码 int updates=6; int *pt=&updates 阅读全文
posted @ 2020-05-21 08:13 财盛 阅读(126) 评论(0) 推荐(0)
摘要: 代码1: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { int rats=101; int *pt=&rats; //101 int & rodents=*pt; 阅读全文
posted @ 2020-05-21 08:12 财盛 阅读(132) 评论(0) 推荐(0)
摘要: 代码1: #include "stdafx.h" #include "iostream" #include "string" using namespace std; int main() { int a=5; cout<<&a<<endl; a=6; cout<<&a<<endl; int *p= 阅读全文
posted @ 2020-05-21 08:01 财盛 阅读(101) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "cstdio" #include "iostream" using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int m=a; if(m>b) m=b; if(m>c) 阅读全文
posted @ 2020-05-21 08:00 财盛 阅读(100) 评论(0) 推荐(0)
摘要: #include "stdafx.h" #include "cstdio" #include "iostream" using namespace std; int main(){ int a,b,c,d; cin>>a>>b>>c>>d; int m=a; if(m>b) m=b; if(m>c) 阅读全文
posted @ 2020-05-21 07:59 财盛 阅读(401) 评论(0) 推荐(0)