请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容变为edcba。注意;部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:$include<string.h>include<conio.h>include<stdio.h>define N 81void fun(char*s){int i=0,t,n=strlen(s);for(;【 】;i++){t=*(s+i);【 】;【 】;}}main(){char a[N];clrscr();printf("Enter a string:");gets(a);printf("The original string is:");puts(a);fun(a);printf("\n");printf("The string after modified:");puts(a);}

请补充函数fun(char *s),该函数的功能是把字符串中的内容逆置。

例如:字符串中原有的字符串为abcde,则调用该函数后,串中的内容变为edcba。

注意;部分源程序给出如下。

请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。

试题程序:

$include<string.h>

include<conio.h>

include<stdio.h>

define N 81

void fun(char*s)

{

int i=0,t,n=strlen(s);

for(;【 】;i++)

{

t=*(s+i);

【 】;

【 】;

}

}

main()

{

char a[N];

clrscr();

printf("Enter a string:");

gets(a);

printf("The original string is:");

puts(a);

fun(a);

printf("\n");

printf("The string after modified:");

puts(a);

}


相关考题:

以下函数 fun 的功能是返回 str 所指字符串中以形参 c 中字符开头的后续字符串的首地址 , 例如 : st r所指字符串为 : Hello! , c 中的字符为 e ,则函数返回字符串 : ello! 的首地址。若 str 所指字符串为空串或不包含 c 中的字符,则函数返回 NULL 。请填空。char *fun(char *str,char c){ int n=0; char *p=str;if(p!=NULL)while(p[n]!=cp[n]!='\0') n++;if(p[n]=='\0') return NULL;return( 【 1 2 】 );}

请编写函数fun(),该函数的功能是:移动字符串中的内容,移动的规则是把第1到第m个字符,平移到字符串的最后,把第m+1到最后的字符移到字符串的前部。例如,字符串中原有的内容为ABCDEFGHIJK,m的值为 3,移动后,字符串中的内容应该是DEFGHIJKABC。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include <stdio. h>include <string.h>define N 80void fun (char *w, int m){}main ( ){char a[N]= "ABCDEFGHIJK";int m;printf ("The origina string : \n");puts (a);printf("\n\nEnter m: ");scanf ("%d", m);fun (a, m);printf (" \nThe string after moving : \n");puts (a);printf ("\n\n");}

请编写一个函数fun(),它的功能是:比较两个字符串的长度,(不得调用C语言提供的求字符串长度的函数),函数返回较K的字符串。若两个字符串长度相等,则返回第1个字符串。例如,输入beijing<CR>shanghai<CR>(<CR>为回车键),函数将返回shanghai。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。试题程序:include<stdio.h>char *fun(char *s, char *t){}main(){char a[20],b[10],*p,*q;int i;printf ("Input 1th string: ");gets(a);printf{"Input 2th string: ");gets(b);printf("%s",fun(a,b));}

以下函数fun的功能是返回str所指字符串中以形参c中字符开头的后续字符串的首地址,例如,str所指字符串为Hello!,c中的字符为e,则函数返回字符串ello!的首地址。若str所指字符串为空或不包含c中的字符,则函数返回NULL,请填空。char *fun(char *str,char c){ int n=0; char *p=str; if(p!=NULL) while(p[n]!=cp[n]!=’\0’) n++; if(p[n]==’\0’) return NULL; return();}

请编写一个函数char *fun(char *s),其中s代表一个字符串。函数fun()的功能是将字符串s的元素倒置。例如,输入为“teacher”,则应输出“rehcaet”。注意:部分源程序已存在文件PROC10.cpp中。请勿修改主函数和其他函数中的任何内容,仅在函数fun()的花括号中填写若干语句。文件PROC10.cpp的内容如下://PROC10. cppinclude <iostream>include <string>using namespace std;char *fun(char *s);int main ( ){char str[81];cout<<"Please enter a string:\n";cin>>str;cout<<"The result is:"<<fun(str));cout<<end1;return 0;}char*fun(char*s){//* * * * * * * * *}

请编一个函数fun(oh lr*str),该函数的功能是把字符串中的内容逆置。 例如,字符串中原有的字符串为asdf9,则调用该函数后,串中的内容为9fdsa。 请勿改动main函数和其他函数中的任何内容,仅在函数proc的花括号中填人所编写的若干语句。 试题程序: includestring.h includeconio.h includestdio.h define N 100 void fun(char * str) { } void main { char a[N]; FILE*out: printf("Enter a string:"); gets(a); printf("The origir al string is:"); puts(a); fun(a): printf("The string after modified:"); puts(a); strcpy(a,"Welcome!"); fun(a); ut=fopen("outfile.dat","w"); fprintf(out,"%s".a); fclose(out); }

请编写函数fun,函数的功能是:移动字符串中的内容,移动的规则如下:把第1到第m个字符,平移到字符串的最后,把第m+l到最后的字符移到字符串的前部。例如,字符串中原有的内容为:ABCDEFGHIJK,m的值为3,则移动后,字符串中的内容应该是:DEFGHIJKABC。注意:部分源程序在文件PROGl.C中。请勿改动主函数main和其他函数中的任何内容,,仅在函数fun的花括号中填入你编写的若干语句。

请编一个函数fun(char*str),该函数的功能是把字符串中的内容逆置。 例如,字符串中原有的字符串为asdfg,则调用该函数后,串中的内容为gfdsa。 请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的花括号中填入所编写的若干语句。 试题程序:

采用递归算法,设计函数,用来实现字符串s的逆置。 递归函数fun(s),返回逆置后的字符串s