Blogroll

Wednesday 7 November 2012

program menghitung kata dalam sebuah kalimat

C++  Program Menghitung Kata Dalam Sebuah Kalimat // tugas vb PR.cpp : Defines the entry point for the console application. // #inc... thumbnail 1 summary
C++ 

Program Menghitung Kata Dalam Sebuah Kalimat


// tugas vb PR.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
#include<iostream.h>
#include<ctype.h>

void main()
{
char kalimat[100];
int i, spasi=0;

cout << "\n\t\t - Program Menghitung Kata Dalam Sebuah Kalimat -\n";
cout << "\t==================================================================\n\n";

cout << "\t Masukan Sebuah Kalimat : ";
cin.getline(kalimat, sizeof(kalimat));

for(i=0; kalimat[i]; i++)
{

if(isspace (kalimat[i]) || ispunct (kalimat[i]))
{
spasi++;


}
}

cout << "\t Jumlah Kata = " << spasi +1 << "\n\n";
cout << "\t Kata yang anda masukan adalah : \n";
cout << "\t ";

for(i=0; kalimat[i]; i++)
{

if(isspace (kalimat[i]) || ispunct (kalimat[i]))
{
spasi++;
cout << "\n";
cout << "\t";

}
cout << kalimat[i];
}

cout << "\n";
cout << "\n\n\t\t  Terima Kasih Telah Menggunakan Program ini\n\n\n";
cout << "\t\t\t   By Raditya Pawitra\n";
cout << "\t\t\t    Politeknik TEDC Bandung\n";
cout << "\n\t\t\t       - Sampai Jumpa -\n";
cout << "\t==================================================================\n\n";

cout << "\n";
getchar();

}




ini hasil dari pemongraman c++



No comments

Post a Comment

About