摘要: 题目描述:开发一个坐标计算工具, A表示向左移动,D表示向右移动,W表示向上移动,S表示向下移动。从(0,0)点开始移动,从输入字符串里面读取一些坐标,并将最终输入结果输出到输出文件里面。输入:合法坐标为A(或者D或者W或者S) + 数字(两位以内),坐标之间以“;”分隔。非法坐标点需要进行丢弃。如 阅读全文
posted @ 2020-04-03 21:15 我为编程上架构 阅读(792) 评论(0) 推荐(0) 编辑
摘要: 两种方式 一:直接排序就行了。对于字符串“>、<、==、+”这些运算符都被重载了,可以直接用。 #include <iostream>using namespace std;#include <string> int main(){ int num; cin >> num; string s[100 阅读全文
posted @ 2020-04-03 20:53 我为编程上架构 阅读(185) 评论(0) 推荐(0) 编辑
摘要: #include <stack>#include <string>using namespace std; int main(){ stack<string> ss; string s; while (cin >> s) { ss.push(s); } while (!ss.empty()) { c 阅读全文
posted @ 2020-04-03 20:48 我为编程上架构 阅读(254) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;#include <string> // hello world ->world helloint main(){ string s, s1, s2; int flag = 0, i = 0; getline(cin, s 阅读全文
posted @ 2020-04-03 20:46 我为编程上架构 阅读(295) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;#include <string> int main(){ string s; getline(cin, s); int a[128] = { 0 }, num = 0; for (int i = 0; i<s.size( 阅读全文
posted @ 2020-04-03 20:29 我为编程上架构 阅读(1320) 评论(0) 推荐(0) 编辑
摘要: //题目描述:输入一个int型整数,按照从右向左的阅读顺序,返回一个不含重复数字的新的整数。 例如:输入9876673,输出37689。 //计数方法解决,简单明了 #include<iostream>using namespace std; int main(){ int n; int a[10] 阅读全文
posted @ 2020-04-03 20:23 我为编程上架构 阅读(423) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> using namespace std; //输入5.5,输出6,如果小数点后数值大于等于5,向上取整;小于5,则向下取整。int main(){ float f; cin>>f; if((f-int(f))>=0.5){ cout<<int(f)+1; }el 阅读全文
posted @ 2020-04-03 20:19 我为编程上架构 阅读(689) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<algorithm>#include<functional>using namespace std; int main(){int a[12]={11,10,20,40,32,67,40,20,89,300,400,15}; sort(a,a+ 阅读全文
posted @ 2020-04-03 20:15 我为编程上架构 阅读(739) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector>using namespace std;//计数排序 void CountSort(vector<int> &arr,int maxVal){ int len = arr.size(); if(len<1){ return; } 阅读全文
posted @ 2020-04-03 20:11 我为编程上架构 阅读(180) 评论(0) 推荐(0) 编辑