Advertisement
icatalin

Siruri de caractere probleme in clasa 25.2.2015

Feb 25th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. //verificati daca 2 cuv rimeaza
  2.  
  3. int main ()
  4. {
  5.     char s[256],s2[256],u2,*u,*q;
  6.     int  m,n;
  7.     cin.getline(s,256);
  8.     cin.getline(s2,256);
  9.     m=strlen(s)-2;
  10.     u=s+m;
  11.     n=strlen(s2)-2;
  12.     q=s2+n;
  13.  
  14. if (strcmp(u,q)==0)
  15.  cout<<"Rimeaza.";
  16. else
  17.  cout<<"Nu rimeaza";
  18.  
  19. return 0;
  20.  
  21. }
  22.  
  23.  
  24.  
  25. #include<iostream>
  26. #include<cstring>
  27.  
  28. using namespace std;
  29.  
  30. //2. se citeste un sir de caractere. precizati daca sirul introdus repr. un numar
  31.  
  32. int main ()
  33. {
  34.     char s[256],s2[256],u2,*u,*q;
  35.     int  m,n,ok=0,i;
  36.     cin.getline(s,256);
  37.      for (i=0;i<strlen(s);i++)
  38.      {
  39.          if (s[i]>='0' && s[i]<='9')
  40.             {
  41.             ok=1;
  42.             break;
  43.             }
  44.      }
  45.      if (ok==0)
  46.         cout<<" nu sunt numere";
  47.         else
  48.         cout<<" sunt numere";
  49.  
  50.  
  51.  
  52.  
  53.    return 0;
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement