Pages

Kamis, 08 November 2012

Assalamualaikum, :) ini salah satu program Visual Studio C++ yg menampilkan kata dalam sebuah kalimat.









// asp.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 - Counting Words In A Sentence -\n";
cout << "\t==================================================================\n\n";

cout << "\t Get The Word : ";
cin.getline(kalimat, sizeof(kalimat));

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

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

}
}

cout << "\t Number Of Word = " << spasi +1 << "\n\n";
cout << "\t The word you entered is: : \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  WELCOME TO MY WORLD ini\n\n\n";
cout << "\t\t\t   By Agung Fajar Riyadi\n";
cout << "\t\t\t    Politeknik TEDC Bandung\n";
cout << "\n\t\t\t       - BOKREH -\n";
cout << "\t==================================================================\n\n";

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

}

Screenshotnya :

 1.



0 komentar:

Posting Komentar