Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Nama Program : Kalimat Spliter
- Dekripsi : Program untuk menentukan jumlah kata.
- Input : Kalimat
- Proses : Mengolah input kalimat
- Output : Menampilkan jumlah kata dalam sebuah kalimat
- Author : Ageung Hidayat
- NIM : TI111002
- */
- #include<stdio.h>
- #include<iostream.h>
- #include<ctype.h>
- void main()
- {
- /*Title*/
- cout<<"\t\t = = = = = = = = = = = = = = ="<<endl;
- cout<<"\t\t = | PROGRAM 1 | ="<<endl;
- cout<<"\t\t= MENAMPILKAN JUMLAH KATA ="<<endl;
- cout<<"\t\t = oleh : Ageung hidayat ="<<endl;
- cout<<"\t\t = = = = = = = = = = = = = = ="<<endl;
- cout<<"\n";
- char kalimat[100];
- int i, space=0;
- cout<<"Masukan Kalimat \t: ";
- cin.getline(kalimat, sizeof(kalimat));
- for(i=0; kalimat[i]; i++)
- {
- if(isspace (kalimat[i]) || ispunct (kalimat[i]))
- {
- space++;
- }
- }
- cout<<"\n";
- cout<<"Kalimat Diatas Terdiri Atas "<<space+1<<" Kata"<<endl;
- cout<<"\n"<<endl;
- cout<<"Keluaran Masing-Masing katanya adalah "<<endl;
- cout<<" ";
- for(i=0; kalimat[i]; i++)
- {
- if(isspace (kalimat[i]) || ispunct (kalimat[i]))
- {
- space++;
- cout<<""<<endl;
- }
- cout<<kalimat[i];
- }
- cout<<""<<endl;
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement