Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <cmath>
- using namespace std;
- int IncrCheck(int num) {
- int buf = abs(num);
- if (buf < 10) return 1;
- while (buf > 9) {
- if (buf % 10 < (buf % 100 - buf % 10) / 10) return 0;
- buf /= 10;
- }
- return 1;
- }
- int main()
- {
- setlocale(LC_ALL, "rus");
- int num, size = 0, i = 0;
- int *save = new int[size];
- cout << "Ввод последовательности: " << endl;
- cin >> num;
- while (num) {
- if (IncrCheck(num)) {
- save[size] = num;
- size++;
- }
- cin >> num;
- }
- cout << "Числа последовательности, в которых цифры расположены в порядке возрастания от старшего к младшему члену: " << endl;
- for (int j = 0; j < size; j++)
- cout << save[j] << " ";
- delete[] save;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement