头像
undeyway
发布于 2020-05-11 21:36
+ 关注

C++

#include<iostream>
#include<vector>
using namespace std;

int main() {
	vector<int> v;
	int a;
	cin >> a;
	if (a >= 100 && a <= 999){
		int b = a;
		while (b > 9) {
			b = b / 10;
			b = a - b * 10;
			v.push_back(b);
			b = a/10;
			a = b;
		}
		v.push_back(b);
		
		for (vector<int>::iterator it=v.begin();it!=v.end();it++)
		{
			cout << *it;
		}
	}
	else
		cout << "输入有误,请重新输入!";
}


全部评论

(0) 回帖
加载中...
话题 回帖

本文相关内容

等你来战

查看全部

热门推荐