2条回答 默认 最新
ysuwood 2015-12-07 13:56关注你参考参考:
#include<stdio.h> #include<string.h> int replace(char*p_str) { int i,n=0; for(i=0;*(p_str+i)!='\0';i++) { if(*(p_str+i)=='t') {*(p_str+i)='e'; n++;} if(*(p_str+i)=='T') {*(p_str+i)='E'; n++;} } return n; } main() { char str[50]; char*p_str=str; int n; printf("input a string:\n"); gets(p_str); n=replace(p_str); printf("the replaced number:%d\n",n); printf("the final string:"); puts(p_str); }本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
