Created
December 4, 2020 08:26
-
-
Save modos/a8ed02e0078072540065fd06a76a252e to your computer and use it in GitHub Desktop.
جمع بزرگان
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************************************************** | |
Online C++ Compiler. | |
Code, Compile, Run and Debug C++ program online. | |
Write your code in this editor and press "Run" button to compile and execute it. | |
*******************************************************************************/ | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
string a,b; | |
string command; | |
cin >> a; | |
cin >> command; | |
cin >> b; | |
if (a.length() < b.length()){ | |
string temp = b; | |
b = a; | |
a = temp; | |
} | |
if (command == "+"){ | |
a[a.length() - b.length()] = a[a.length() - b.length()] + 1; | |
}else if (command == "*"){ | |
for (int i = 1; i < b.length(); i++) { | |
a = a + '0'; | |
} | |
} | |
cout << a; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment