IJUL'S BLOG

Mencari Huruf Vokal pada Kalimat

catatan kuliahq:
ni source code nya :

#include<iostream.h>
#include<conio.h>
#include<string.h>

void main()
{
    int k,a,i,u,e,o;
    char teks[25];
    cout<< "inputkan kalimat = ";
    cin.get(teks,sizeof(teks));
    a=i=u=e=o=0;
    cout<< " kalimat yang diinputkan = "<<teks<<endl;
    for (k=0;k<strlen(teks);k++)
    {
        if (teks[k]=='a'||teks[k]=='A')
        a=a+1;
        if (teks[k]=='i'||teks[k]=='I')
        i=i+1;
        if (teks[k]=='e'||teks[k]=='E')
        e=e+1;
        if (teks[k]=='u'||teks[k]=='U')
        u=u+1;
        if (teks[k]=='o'||teks[k]=='O')
        o=o+1;
     }
     if (a>0)
     cout<<"Huruf a ada "<<a<<endl;
     if (i>0)
     cout<<"Huruf i ada "<<i<<endl;
      if (e>0)
     cout<<"Huruf e ada "<<e<<endl;
      if (u>0)
     cout<<"Huruf u ada "<<u<<endl;
      if (o>0)
     cout<<"Huruf o ada "<<o<<endl;

}

0 komentar:

Posting Komentar

Powered By Blogger
Diberdayakan oleh Blogger.

Entri Populer

PENGUNJUNG

Buku Tamu

About Me

Foto Saya
Ijal Ferdi
there is no something special about me,,, but this blog is so special for me......
View my complete profile

Total Tayangan Halaman

Followers