摘要: 1、输入十个正整数数字从小到大排序 输入:1 2 5 7 9 10 45 67 24 26 输出:1,2,5,7,9,10,24,26,45,67 #include <iostream> #include <vector> #include <algorithm> using namespace s 阅读全文
posted @ 2020-03-25 23:52 AlsoRan 阅读(547) 评论(0) 推荐(0)
摘要: 1、输入一组单词(区分大小写),统计首字母相同的单词的个数,相 同的单词不累加,输出格式:“字母,个数” input: I am a boy,you are a boy. output: I,1 a,3 b,1 y,1 #include <iostream> #include <map> #incl 阅读全文
posted @ 2020-03-25 00:15 AlsoRan 阅读(508) 评论(0) 推荐(0)
摘要: 1.输入一串整数,输入命令排序! 输入 a t 在这串整数后面添加整数 t, 输入 c\m\n 有 n 替换 m, 输入 d t 删除 t, 输入 s 排序。 #include <iostream> #include <vector> #include <cstring> #include <alg 阅读全文
posted @ 2020-03-25 00:13 AlsoRan 阅读(484) 评论(0) 推荐(1)
摘要: 1、使用时加入头文件#include <map>; 2、从前遍历it = map.begin(); it != map.end(); it++ 3、从后遍历it = map.rbegin(); it != map.rend(); it++ 4、map.end() -- 不一定指向最后一个元素,指向最 阅读全文
posted @ 2020-03-23 00:09 AlsoRan 阅读(221) 评论(0) 推荐(0)
摘要: 1、请输入字符串,最多输入4 个字符串,要求后输入的字符串排在前面,例如 输入:EricZ 输出:1=EricZ 输入:David 输出:1=David 2=EricZ 输入:Peter 输出:1=Peter 2=David 3=EricZ 输入:Alan 输出:1=Alan 2=Peter 3=D 阅读全文
posted @ 2020-03-21 23:41 AlsoRan 阅读(390) 评论(0) 推荐(0)
摘要: 1、存储一组姓名,如Apple Tom Green Jack要求能排序、按字母顺序插入、并显示。 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { string s 阅读全文
posted @ 2020-03-21 21:32 AlsoRan 阅读(299) 评论(0) 推荐(0)
摘要: 1、一个小球,从高为H的地方下落,下落弹地之后弹起高度为下落时的一半,比如第一次弹起高度为H/2,如此反复,计算从小球H高度下落到n次弹地往返的总路程。 #include <iostream> #include <cmath> using namespace std; int h; double c 阅读全文
posted @ 2020-03-21 21:07 AlsoRan 阅读(325) 评论(0) 推荐(0)
摘要: 1、写一个程序判断字符串中数字的位置. 例如:输入 a3b4c5 输出 2 4 6 #include <iostream> using namespace std; int main() { string s; while(cin >> s) { for (int i = 0; i < s.leng 阅读全文
posted @ 2020-03-21 15:29 AlsoRan 阅读(276) 评论(0) 推荐(0)
摘要: 1、给定一个程序,关于字符串的,要求输入并调试,说出此程序的意图。意图是按字母顺序对两个字符串比较排序。 第二问要求用尽可能少的语句对该程序进行修改,使其能够对两个字符串比较长度排序。 #include <iostream> #include <algorithm> using namespace 阅读全文
posted @ 2020-03-21 00:42 AlsoRan 阅读(268) 评论(0) 推荐(0)
摘要: 1、建立一个角类,在这个类中重载减号运算符,并实现求出角度的正弦值的函数。 #include <iostream> #include <cmath> using namespace std; class angel { public: double x1, x2; double getangel() 阅读全文
posted @ 2020-03-20 21:13 AlsoRan 阅读(305) 评论(0) 推荐(0)