C++ is an amazing language. Those who have learnt it consider it to be most easiest languages. Everything and every program which you can think of can be made on C++.
Its not that I have learnt it so I am saying it's a fact and no one cab deny it. Here when we (The Best within Everything) have reached 7K visitors till now I had thought of expanding the scope to C++ as well.
Here now onwards the difficult programs of C++ which I'd be encountering will be published with tag C++.
How to reverse each letter of word of given string?
This program uses only three loops and 4 variables.
Anyone have a better code us invited to write on our blog
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,k,l;
char str[101];
i=0;
j=0;
cout<<"Enter a String: ";
gets(str);
cout<<" \n";
for(l=0, k=0; str[k]!='\0';l++,k=i+1)
{
for(i=k; str[i]!=' 'i+=1);
for(j=i-1; str[j]!=' '||j>=0; j-=1)
{
cout<<str[j];
}
cout<<" ";
}
getch();
}
0 comments:
Post a Comment
Thank you !