Advertisement
Guest User

metagram

a guest
Feb 17th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8. cout<<"ile prob? "<<endl;
  9. cin>>n;
  10. for (int m=0;m<n;m++)
  11. {
  12.     string a,b;
  13.     cout<<"podaj 1 slowo "<<endl;
  14.     cin>>a;
  15.     cout<<"podaj 2 slowo "<<endl;
  16.     cin>>b;
  17.     int i,j,r=0,o=0;;
  18.     i = a.length();
  19.     j = b.length();
  20.     if (i==j)
  21.     {
  22.         for(o=0;o<i;o++)
  23. {
  24.  
  25.  
  26.         if(a[o]!=b[o])
  27.         {
  28.             r=r+1;
  29.  
  30.         }
  31. }
  32. if (r==1)
  33. {
  34.     cout<<"sa metagramami"<<endl;
  35. }
  36. else
  37. {
  38.     cout<<"nie sa"<<endl;
  39. }
  40.     }
  41.     else
  42.     {
  43.         cout<<"roznej dlugosci"<<endl;
  44.  
  45.     }
  46.  
  47.  
  48. }
  49.  
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement