the program should read user input. the output would be like this:
Enter String: the quick brown fox //then press enter
hetay uickqay rownbay oxfay
/****the 1st letter of the word is transferred to the last and will be added a suffix AY.I have a program here but i don't know how to transfer the 1st letter to the last.i can only delete the 1st letter.I don't know what to do.pls i need i help!****////
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
#include%26lt;string.h%26gt;
void main()
{
clrscr();
char *str1;
char *str2={"ay"};
char *p;
int i;
int len;
printf("Enter String: ");
gets(str1);
p=strtok(str1," ");
if(p)
{
len=strlen(p);
for(i=0;i%26lt;len;i++)
{
p[i]=p[i+1];
}
len--;
printf("%s%s ",p,str2);
}
while(p=strtok(NULL," "))
{
len=strlen(p);
for(i=0;i%26lt;len;i++)
{
p[i]=p[i+1];
}
len--;
printf("%s%s ",p,str2);
}
getch();
}
C programming pls help me..... i need an answer ASAP =)?
You get the index of the last letter first, and then assign
the 1st letter (index 0) to the last index in your char array.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment