Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- char input[100];
- int vokal=0, konsonan=0, kounter;
- cout<<"Masukan Kalimat = ";
- cin.getline(input, 100);
- for(kounter=0; kounter<strlen(input); kounter++){
- if(input[kounter]==' '){
- cout<<"0"<<" ";
- }
- else{
- cout<<int(input[kounter])-96<<" ";
- }
- }
- cout<<"\nKalimat setelah dibalik = "<<strrev(input)<<endl;
- for(int kounter=0; kounter<strlen(input); kounter++){
- if(input[kounter]=='a' || input[kounter]=='i' || input[kounter]=='u' ||
- input[kounter]=='e' || input[kounter]=='o'){
- vokal++;
- }
- else{
- konsonan++;
- }
- }
- cout<<"Jumlah huruf vokal = "<<vokal<<endl;
- cout<<"Jumlah huruf konsonan = "<<konsonan<<endl;
- }
Add Comment
Please, Sign In to add comment