Advertisement
Anna3O0

Caractere Fisa 5

Nov 20th, 2020 (edited)
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3.  
  4. using namespace std;
  5.  
  6. void cifre(char s[101])
  7. {
  8.     cout<<"Ex 1"<<endl;
  9.     int i=0;
  10.     cin.get(s,100);
  11.     while(i<strlen(s))
  12.     {
  13.         if(s[i]<'0' || s[i]>9)
  14.             strcpy(s+i,s+i+1);
  15.         else
  16.             i++;
  17.     }
  18.     if(strlen(s)!=0)
  19.         cout<<s;
  20.     else
  21.         cout<<"SIR VID";
  22. }
  23. void faraCon(char s[101])
  24. {
  25.     cout<<"Ex 2"<<endl;
  26.     int i=0;
  27.     cin.get(s,100);
  28.     while(i<strlen(s))
  29.     {
  30.         if(strchr("aeiou",s[i])==NULL)
  31.             strcpy(s+i,s+i+1);
  32.         else
  33.             i++;
  34.     }
  35.     if(strlen(s)!=0)
  36.         cout<<s;
  37.     else
  38.         cout<<"SIR VID";
  39. }
  40. void alfabetic(char s[101])
  41. {
  42.     cout<<"Ex 3"<<endl;
  43.     int fr[201]={0},i;
  44.     cin.get(s,100);
  45.     for(i=0;i<strlen(s);i++)
  46.         if(s[i]>='a'&& s[i]<='z'&& fr[s[i]]==0)
  47.         {
  48.             fr[s[i]]=1;
  49.         cout<<s[i]<<" ";
  50.         }
  51. }
  52. void cuvinte(char s[101])
  53. {
  54.     cout<<"Ex 4"<<endl;
  55.     char *p;
  56.     cin.get(s,100);
  57.     int k=0,k1=0,i=0;
  58.     p=strtok(s," ");
  59.     while(i<strlen(s))
  60.     {
  61.         if(strchr("aeiou",s[0]))
  62.             k1++;
  63.         p=strtok(NULL," ");
  64.         k++;
  65.         i++;
  66.     }
  67.     cout<<k<<" "<<k1;
  68. }
  69. int main()
  70. {
  71.     char s[101];
  72.     //cifre(s);
  73.     //faraCon(s);
  74.     //alfabetic(s);
  75.     cuvinte(s);
  76.     return 0;
  77. }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement