-
-
Save AlexandruFilipescu/8bb14d2b1cc0707098b187ffb21405b6 to your computer and use it in GitHub Desktop.
C++ Problema verificare a 2 numere daca se regasesc toate dintr-o cifra, in cealalta(Problem that verifies if a number has the same figures with another number)
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
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main() { | |
int n,m,v,w,a,b; | |
string str; | |
bool egale; | |
cin >> n >> m; | |
v = n; | |
w = m; | |
while (n != 0) { | |
a = n % 10; | |
egale = false; | |
while (w != 0) { | |
b = w % 10; | |
if (a == b) { | |
egale = true; | |
} | |
w /= 10; | |
} | |
w = m; | |
if (egale == false) { | |
str = "Numerele nu sunt formate din aceleasi cifre!"; | |
} | |
else { | |
str = "Numerele sunt formate din aceleasi cifre!"; | |
} | |
n /= 10; | |
} | |
cout << str; | |
cout << endl; | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment