Advertisement
Guest User

Untitled

a guest
Mar 30th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. void main()
  6. {
  7.     int N, c;
  8. m1:
  9.     cout << "input number: ";
  10.    
  11.     if (cin >> N;)
  12.     {
  13.         if (N != 0)
  14.         {
  15.             if (N < 0)
  16.                     N = abs(N);
  17.  
  18.             for (int i = 9; i >= 0; i--)
  19.             {
  20.                     int N1 = N;
  21.                     int f = 0;
  22.                     while (N1 != 0)
  23.                     {
  24.                             int a = N1 % 10;
  25.                             N1 = N1 / 10;
  26.                             if (a == i)
  27.                                     f = 1;
  28.                     }
  29.                     if (f == 0)
  30.                             cout << i << " ";
  31.             }
  32.         }
  33.         else
  34.         {
  35.                 cout << endl << "Number must be different from 0" << endl << "Try again" << endl;
  36.                 goto m1;
  37.         }
  38.     }
  39.     else
  40.     {
  41.         cout << endl << "Type mismatch" << endl << "Try again" << endl;
  42.         goto m1;
  43.     }
  44.  
  45.     cout << endl << "One more?" << endl << "0 - No / 1 - Yes: ";
  46.     cin >> c;
  47.     if (c == 1)
  48.             goto m1;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement