Search

Sabtu, 14 April 2012

Replace The Letters of a Sentence

Today I will share the coding of the basic programming using Borland C + +, may be useful for the friend my friend as well.
 
Replace The Letters of a Sentence


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

void main()
{
char kal[100],a,b;
cout<<"replace the letters of a sentence:"<<endl<<endl;
cout<<"sentence:";
gets(kal);
cout<<"letters are replaced:";
cin>>a;
cout<<"replacement letter:";
cin>>b;
cout<<"result:";
for(int i=0; i<=strlen(kal); i++)
{
if(kal[i]==a)
cout<<b;
else
cout<<kal[i];
}
getch();
}

good luck with my friends :)

Tidak ada komentar:

Posting Komentar