#include <iostream>
using namespace std;
int main()
{
int a,x;
int y=0,b=0,MAKS = 256;
char kata[MAKS],huruf[MAKS];
cout<<"masukkan kata atau kalimat = ";
cin.getline( kata, MAKS );
cout<<"masukkan huruf yang akan di cari jumlahnya = ";
cin>>huruf;
for ( x = 0 ; kata[x]; x++ ) {
y++;
}
for ( a = 0 ; a<y; a++ ) {
if (kata[a]==huruf[0] || kata[a]==huruf[0]+32 || kata[a]==huruf[0]-32)
b++;
}
cout<<"jumlah huruf "<<huruf<<" = "<<b<<endl ;
cin.get();
cin.get();
}
No comments:
Post a Comment