oke_google

Modul 3.6

Nov 29th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char input[100], kopi[100], kopi2[100];
  9.     int kounter; int vokal=0; int konsonan=0;int besar=0;int kecil=0;int gang=0, offset, gantine;
  10.     cout<<"Input User       = ";
  11.     cin.getline(input, 100);
  12.     kopi==strcpy(kopi, input);
  13.     cout<<"Original         = "<<input<<endl;
  14.     cout<<"Reserved         = "<<strrev(kopi)<<endl;
  15.     kopi==strcpy(kopi, input);
  16.     cout<<endl;
  17.     cout<<"Uppercase        = "<<strupr(kopi)<<endl;
  18.     cout<<"Lowercase        = "<<strlwr(kopi)<<endl;
  19.     for(kounter=0; kounter<strlen(input); kounter++){
  20.         if(input[kounter]>='A' && input[kounter]<='Z'){
  21.             besar++;
  22.            }
  23.         else if(input[kounter]==' '){
  24.             gang=0;
  25.         }
  26.         else{
  27.             kecil++;
  28.         }
  29.     }
  30.     cout<<endl;
  31.     cout<<"Ucase total      = "<<besar<<endl;
  32.     cout<<"Lcase total      = "<<kecil<<endl;
  33.     kopi==strcpy(kopi, input);
  34.     kopi2==strcpy(kopi2, input);
  35.     for(kounter=0; kounter<strlen(input); kounter++){
  36.         if(input[kounter]=='a' || input[kounter]=='i' || input[kounter]=='u' ||
  37.            input[kounter]=='e' || input[kounter]=='o' || input[kounter]=='A' ||
  38.            input[kounter]=='I' || input[kounter]=='U' || input[kounter]=='E' || input[kounter]=='O'){
  39.             vokal++;
  40.             kopi[kounter]=' ';//Menghilang Huruf Vokal;
  41.            }
  42.         else if(input[kounter]==' '){
  43.             gang++;
  44.         }
  45.         else{
  46.             konsonan++;
  47.             kopi2[kounter]=' ';//Menghilangkan Huruf Bukan Vokal
  48.         }
  49.     }
  50.     cout<<endl;
  51.     cout<<"Vocals           = "<<vokal<<endl;
  52.     cout<<"!Vocals          = "<<konsonan<<endl;
  53.     cout<<"Spaces           = "<<gang<<endl;
  54.     cout<<endl;
  55.     cout<<"Hide Vocals      = "<<kopi<<endl;
  56.     cout<<"Hide !Vocals     = "<<kopi2<<endl<<endl;
  57.     cout<<"Input Offset     = ";
  58.     cin>>offset;
  59.     kopi==strcpy(kopi, input);
  60.     for(kounter=0; kounter<strlen(input); kounter++){
  61.         if(kopi[kounter]==' '){
  62.             kopi[kounter]=' ';
  63.         }
  64.         else{
  65.         gantine=int(kopi[kounter])+offset;//Merubah ke kode ASCII
  66.         kopi[kounter]=char (gantine);//Merubah ASCII ke Karakter
  67.         }
  68.     }
  69.     cout<<"Offset Text      = "<<kopi;
  70.     cout<<endl;
  71. }
Add Comment
Please, Sign In to add comment