Get paid to share your links!

Program Penghitung Huruf C++

Saturday, March 9, 2013

Kompiler : Borland C++
Algoritma :
  1. Start
  2. Inputkan kata/kalimat
  3. Langkah 1 : Cek kata/kalimat dari huruf pertama hingga akhir dan hitung
  4. Langkah 2 : Cek kata/kalimat dari huruf pertama hingga akhir dan hitung, dengan ketentuan menghitung huruf vokal (a,i,u,e,o)
  5. Langkah 3 : Hitung huruf selain huruf vokal (a,i,u,e,o) dengan mengurangkan langkah 1 dengan langkah 2
  6. Tampilkan hasil penghitungan langkah 1, 2, dan 3
  7. end
Script

#include <conio.h>
#include <iostream.h>
#include <stdio.h>

int main()
{
   char kata[100];
int a,kalimat=0,voc=0,lain;
   cout<<"==============================\n";
   cout<<"=  Program Menghitung Huruf  =\n";
   cout<<"==============================\n";
   cout<<"\n";
   cout<<"Tuliskan kalimat !\n\n";
   gets(kata);

   for (a=0; kata[a]!='\0';a++)
   {
   kalimat++;
   }

   for (a=0; kata[a]!='\0';a++)
   {
     if(kata[a]=='a'||kata[a]=='e'||kata[a]=='i'||kata[a]=='o'||kata[a]=='u')
{
voc++;
}
   }

   lain=kalimat-voc;

   cout<<"\n";
   cout<<"Total Semua Karakter yang ada            : "<<kalimat<<endl;
   cout<<"Total Huruf Vokal (a,i,u,e,o)            : "<<voc<<endl;
   cout<<"Total Huruf nonVokal dan karakter lainya : "<<lain<<endl;

  getch();
}


Share this article :

0 comments:

Speak up your mind

Tell us what you're thinking... !

Followers

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Blog - All Rights Reserved
Template Created by Creating Website Inspired by Sportapolis Shape5.com
Proudly powered by Blogger