Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- switch (n)
- {
- case 1:
- int cresc, c1, c2 ;
- c1 = 10; cresc = 1;
- cout << "n= "; cin >> n;
- while (n != 0 && cresc == 1)
- {
- c2 = n % 10;
- if (c1 < c2) cresc = 0;
- n /= 10;
- c1 = c2;
- }
- if (cresc == 1) cout << "Cifrele numarului sunt in ordine crescatoare." << endl;
- else cout << "Cifrele numarului nu sunt in ordine crescatoare." << endl;
- break;
- case 2:
- int ci;
- ci = 1;
- cout << "n= "; cin >> n;
- c2 = n % 10;
- while (n != 0 && ci == 1)
- {
- c1 = n % 10;
- if (c1 != c2) ci = 0;
- n /= 10;
- c1 = c2;
- }
- if (ci == 1) cout << "Numarul are toate cifrele identice." << endl;
- else cout << "Numarul nu are toate cifrele identice." << endl;
- break;
- case 3:
- int a, b, des; des = 1;
- cout << "n= "; cin >> n;
- cout << "Intrd. o valoare: "; cin >> a;
- for (int i = 2; i <= n && des == 1; i++)
- {
- cout << "Intrd. o valoare: "; cin >> b;
- if (b > a) des = 0;
- a = b;
- }
- if (des == 1) cout << "Valorile sunt in ordine descrescatoare." << endl;
- else cout << "Valorile nu sunt in ordine descrescatoare." << endl;
- break;
- default:
- cout << "Problema nu exista." << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement