Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <iostream>
- using namespace std;
- int main(){
- char s[256];
- int i=0;
- int jmlvokal=0, jmlnonvokal=0;
- cout << "Masukkan nama :" << endl;
- gets(s);
- cout << "Panjang Kalimat: " << strlen(s)<<endl;
- while(i!=strlen(s)){
- //hitung huruf vokal
- if(s[i]=='a'||s[i]=='i'||s[i]=='u'||s[i]=='e'||s[i]=='o') jmlvokal++;
- //hitung huruf nonvokal
- else jmlnonvokal++;
- i++;
- }
- cout << "Jumlah Huruf Vokal: " << jmlvokal<<endl;
- cout << "Jumlah Huruf Nonvokal: " << jmlnonvokal;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement