пожалуйста переведите на с++
#include
#include
#include
#include
#include
#include
#include
#include

using namespace std;
int main() {
ifstream fi ("INPUT.TXT");
ofstream fo ("OUTPUT.TXT");
string a, b;
fi >> a >> b;
if (a[0] == '-') sort(a.begin() + 1, a.end());
else {
sort(a.begin(), a.end());
reverse(a.begin(), a.end());
}
if (b[0] == '-') {
sort(b.begin() + 1, b.end());
reverse(b.begin() + 1, b.end());
} else {
sort(b.begin(), b.end());
}
int zeroInA = 0, zeroInB = 0;
for(int i = 0; i < a.size(); i++) {
if (a[i] == '0') {
a.erase(i, 1);
zeroInA++;
} else break;
}
for (int i = 0; i < b.size(); i++)
if (b[i] == '0') {
b.erase(i, 1);
zeroInB++;
}
else break;
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.