===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
char a[80],b[30],c[80];
clrscr();
cprintf("Enter Paragraph: ");
gets(a);
for(i=0,n=0;c[i-1]!='\0';i++,j--)
{
if(n==0)
{
for(j=i;a[j]!='\0' && a[j]!=' ';j++)
b[j]=a[j];
n=1;
j--;
k=i;
}
c[i]=b[j];
if(j==k)
{
n=0;
i++;
if(a[i]==' ')
c[i]=' ';
else
{
c[i]='\0';
break;
}
}
}
gotoxy(1,3);
cprintf("Changed Paragraph: ");
textbackground(CYAN);
textcolor(RED);
for(i=0;c[i]!='\0';i++)
cprintf("%c",c[i]);
getch();
}
CODING
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<stdio.h>
void main()
{
int i,j,k,n;
char a[80],b[30],c[80];
clrscr();
cprintf("Enter Paragraph: ");
gets(a);
for(i=0,n=0;c[i-1]!='\0';i++,j--)
{
if(n==0)
{
for(j=i;a[j]!='\0' && a[j]!=' ';j++)
b[j]=a[j];
n=1;
j--;
k=i;
}
c[i]=b[j];
if(j==k)
{
n=0;
i++;
if(a[i]==' ')
c[i]=' ';
else
{
c[i]='\0';
break;
}
}
}
gotoxy(1,3);
cprintf("Changed Paragraph: ");
textbackground(CYAN);
textcolor(RED);
for(i=0;c[i]!='\0';i++)
cprintf("%c",c[i]);
getch();
}
===========================================================================
No comments:
Post a Comment