Advertisement
FloudMe77

Untitled

Apr 15th, 2019
97
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.  
  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.   int d=liczba1.length();
  13.   cout<<"d to"<<d;
  14.   for(int i=0;i<d;i++)
  15.   {
  16.       if(liczba1[i]==52)
  17.       {
  18.           liczba1[i]=51;
  19.           cout<<"to dobrze l1 "<<i<<" "<<liczba1[i]<<endl;
  20.           liczba2[i]=49;
  21.           cout<<"to dobrze l2 "<<i<<" "<<liczba2[i]<<endl;
  22.       }
  23.       else
  24.       {
  25.           liczba2[i]=48;
  26.           cout<<"to zle "<<i<<" to "<<liczba2[i]<<endl;
  27.       }
  28.   }
  29.   for(int j=0;j<d;j++)
  30.   {
  31.       cout<<liczba1[j];
  32.   }
  33.   cout<<endl;
  34.   for(int k=0;k<d;k++)
  35.   {
  36.       if((liczba2[k]>48)||(cos<0))
  37.       {
  38.         cout<<liczba2[k];
  39.         cos++;
  40.       }
  41.   }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement