Menghitung Jumlah Vokal Konsonan
#include<iostream>
#include<iomanip>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
cout<<"|=====================================================|"<<endl;
cout<<"|==================VOCAL==============================|"<<endl;
cout<<"|====Menghitung==========AND==========================|"<<endl;
cout<<"|============================KONSONAN=================|"<<endl;
cout<<"|=====================================================|"<<endl;
char chrkata[256];
int nKonsonan=0, nVokal=0, nPembilang;
cout<<"\nMasukan Kata: "<<endl;
cin>>chrkata;
for(nPembilang=0; nPembilang < strlen(chrkata); nPembilang++)
{
if( (toupper(chrkata[nPembilang])>='A') && (toupper(chrkata[nPembilang])<'Z') )
if (
(toupper(chrkata[nPembilang])=='A')||
(toupper(chrkata[nPembilang])=='E')||
(toupper(chrkata[nPembilang])=='I')||
(toupper(chrkata[nPembilang])=='O')||
(toupper(chrkata[nPembilang])=='U')
)
{nVokal++;
}
else
nKonsonan++;
}
cout<<"\nHuruf Konsonan"<<setw(4)<<": "<<nKonsonan<<endl;
cout<<"\nHuruf Vokal"<<setw(7)<<": "<<nVokal<<endl;
cout<<"\nKeterangan: "<<endl;
cout<<"\n\t-Huruf Vokal yaitu: A, I, U, E, O "<<endl;
cout<<"\t-Akan menambahkan jumlah Vokal ke Huruf Vokal "<<endl;
cout<<"\n\t-Selebihnya Akan masuk ke jumlah Konsonan "<<endl;
cout<<"______________________________________________________"<<endl;
cout<<"Copyright@"<<endl;
cout<<"By: Tom Richard"<<endl;
cout<<"======================================================"<<endl;
getch();
}
#include<iomanip>
#include<conio.h>
#include<string>
using namespace std;
int main()
{
cout<<"|=====================================================|"<<endl;
cout<<"|==================VOCAL==============================|"<<endl;
cout<<"|====Menghitung==========AND==========================|"<<endl;
cout<<"|============================KONSONAN=================|"<<endl;
cout<<"|=====================================================|"<<endl;
char chrkata[256];
int nKonsonan=0, nVokal=0, nPembilang;
cout<<"\nMasukan Kata: "<<endl;
cin>>chrkata;
for(nPembilang=0; nPembilang < strlen(chrkata); nPembilang++)
{
if( (toupper(chrkata[nPembilang])>='A') && (toupper(chrkata[nPembilang])<'Z') )
if (
(toupper(chrkata[nPembilang])=='A')||
(toupper(chrkata[nPembilang])=='E')||
(toupper(chrkata[nPembilang])=='I')||
(toupper(chrkata[nPembilang])=='O')||
(toupper(chrkata[nPembilang])=='U')
)
{nVokal++;
}
else
nKonsonan++;
}
cout<<"\nHuruf Konsonan"<<setw(4)<<": "<<nKonsonan<<endl;
cout<<"\nHuruf Vokal"<<setw(7)<<": "<<nVokal<<endl;
cout<<"\nKeterangan: "<<endl;
cout<<"\n\t-Huruf Vokal yaitu: A, I, U, E, O "<<endl;
cout<<"\t-Akan menambahkan jumlah Vokal ke Huruf Vokal "<<endl;
cout<<"\n\t-Selebihnya Akan masuk ke jumlah Konsonan "<<endl;
cout<<"______________________________________________________"<<endl;
cout<<"Copyright@"<<endl;
cout<<"By: Tom Richard"<<endl;
cout<<"======================================================"<<endl;
getch();
}
Komentar
Posting Komentar