Advertisement
FloudMe77

Untitled

Apr 15th, 2019
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.   string liczba1;
  8.   string liczba2;
  9.   int cos;
  10.   cout<<"Podaj liczbe: ";
  11.   cin>>liczba1;
  12.   liczba2=liczba1;
  13.   int d=liczba1.length();
  14.   for(int i=0;i<d;i++)
  15.   {
  16.       if(liczba1[i]==52)
  17.       {
  18.           liczba1[i]=51;
  19.           liczba2[i]=49;
  20.       }
  21.       else
  22.       {
  23.           liczba2[i]=48;
  24.       }
  25.   }
  26.   for(int j=0;j<d;j++)
  27.   {
  28.       cout<<liczba1[j];
  29.   }
  30.   cout<<endl;
  31.   for(int k=0;k<d;k++)
  32.   {
  33.       if((liczba2[k]>48)||(cos>0))
  34.       {
  35.         cout<<liczba2[k];
  36.         cos++;
  37.       }
  38.   }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement