Meninjau Kemunculan “-an” dalam suatu kata / kalimat

Posted: October 12, 2010 in Algoritma & Struktur Data
Tags:

#include
#include

main()
{
int i,kalimat = 0;
char kata[200];

cout<<"Masukkan suatu kalimat (maksimal 200 karakter) : ";
cin.getline(kata, sizeof(kata));

for(i=0; kata[i]; i++)
{
if((kata[i]=='A') || (kata[i]=='a') && (kata[(i+1)]=='N') || (kata[(i+1)]=='n'))
kalimat++;
}

cout<<"Jumlah kemunculan pasangan huruf 'an' = "<<kalimat;cout<<endl;
cout<<endl;
cout<<endl;
cout<<"\t Created By "<<endl;
cout<> || <> || <<- "<<endl;
cout<<"\t Algoritma & Struktur Data ";
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s