用字符数组作函数参数编程,利用一个数组实现字符串(允许输入带空格的字符串)的逆序存放。要求如下: (1)在主函数中从键盘输入字符串,字符串的最大长度为80个字符。 调用Inverse()函数将字符串逆序存放,然后在主函数中输出逆序后的字符串。 (2)在子函数Inverse()中实现字符串的逆序存放。函数原型为: void Inverse(char str[]); 在空白处填写适当的表达式或语句,使程序完整并符合题目要求。 #include <stdio.h> #include <string.h> #define N 80 void Inverse(char str[]); int main() { char a[N]; printf("Input a string:\n"); ________; Inverse(a); printf("Inversed results:\n"); ________; return 0; } void Inverse(char str[]) { int len, i, j; char temp; len = __________; for (___________; i <j; i++, j--) { temp="str[i];" str[i]="str[j];" str[j]="temp;" }> A、第9行: gets(a) 第13行: puts(a) 第22行: strlen(str) 第24行: i=0, j=len-1
B、第9行: get(a) 第13行: put(a) 第22行: strlen(str) 第24行: i=1, j=len
C、第9行: gets(a) 第13行: puts(a) 第22行: sizeof(str) 第24行: i=0, j=len
D、第9行: getchar(a) 第13行: putchar(a) 第22行: sizeof(str) 第24行: i=1, j=len-1
A.正文一般每页排22行,每行排28个字。
B.正文一般每页排22行,每行排26个字。
C.正文一般每页排24行,每行排28个字。
D.正文一般每页排24行,每行排26个字。
程序题: 用Windows“记事本”创建一个文本文件,其中每行包含一段英文。试读出文件的全部内容,并判断: (1)该文本文件共有多少行? (2)文件中以大写字母P开头的有多少行? (3)一行中包含字符最多的和包含字符最少的分别在第几行? 如:记事本内容为: A lot of people today are animal rights advocates. Some of them are very Passionate and even quite radical about the issue. But others argue that “human rights” will always take priority. In fact, in many places even the most basic human rights are not adequately Protected. So why animal rights? What do you think? And why? 运行结果为: 该文本文件共有有8行 文件中以大写字母P开头的有2行 包含字符最多的是第1行 包含字符最少的是第8行
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!