⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modi33.c

📁 c题库
💻 C
字号:
/*
下列给定程序中,函数fun的功能是:将s所指字符串中的字母转换为按字母序列的后续字母(但Z转换为A,z转换为a) ,其他字符不变。
请改正函数fun中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
*/

#include <string.h>
#include <ctype.h>
#include <conio.h>
void fun(char *s)
{
/**********found************/
	while(*s!='@')
	{	if(*s>='A'&&*s<='Z'||*s>='a'&&*s<='z')
		{	if(*s=='Z')*s='A';
			else if(*s=='z')*s='a';
			else *s+=1;
		}
/**********found************/
		(*s)++;
	}
}

main()
{	char s[80];
	clrscr();
	printf("\n Enter a string with length<80 :\n\n");gets(s);
	printf("\n The string :\n\n");puts(s);
	fun(s);
	printf("\n\n The Cord :\n\n ");puts(s);
}

/*
答案:
  while(*s!='@')改为 while(*s)
   (*s)++改为s++;;
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -