![](https://lstatic.shangxueba.com/jiandati/h5/images/m_q_title.png)
![](https://lstatic.shangxueba.com/jiandati/pc/images/logo2.png)
![在数据区STRING首址开始存放一段大写字母的英文信息,最后以“$”为结束标志,编一个程序,分别统计其](https://img2.soutiyun.com/shangxueba/askcard/2023-06/21/1060/20230621170607324.jpg)
A. ―格式‖菜单中的―更改大小写‖命令
B. ―工具‖菜单中的―自动更正‖命令
C. ―工具‖菜单中的―拼写与语法‖命令
D. ―编辑‖菜单中的―替换‖功能
B、c+48
C、C+65
D、C+97
【说明】
从文件IN.DAT中读取一篇英文文章存入到字符串数组XX中;请编写程序,其功能是:以行为单位把字符串中所有小写字母。左边的字符串内容移到该串的右边存放,然后把小写字母。删除,余下的字符串内容移到已处理字符串的左边存放。最后把已处理的字符串仍按行重新存入字符串数组XX中,最后调用函数WRITEDAT(),把结果XX输出到文件 OUT5.DAT中。
例如:原文:You can create an index on any field.
you have the correct record.
结果:n any field.Yu can create an index
rd. yu have the crreet res
原始数据文件存放的格式是:每行的宽度均小于80个字符,含标点符号和空格。
【函数】
include "stdio.h"
include "string.h"
include "conio.h"
include "ctype.h"
include "mem.h"
unsigned char xx[50] [80]
int maxline=0;
int readdat(void);
void writedat(void)
/*将题目要求的字符串中所有小写字母o左边的字符串内容移到谊串的右边存放,即将串中“最后”一个字母o左右两侧的内容互换*/
void StrOR(void)
{
inti;
char*p1,* p2,t[80];
for(i=0;i<maxline;i++)
{ t[0]='/0';
p2=xx[i];
while(*p2) /*找到最后一个别'o'*/
{ if((1))p1=p2;
p2++;
}
strcat(t,p1+1);
*p1='\0';
strcat(t,xx[i]);
p1=xx[i];
p2=t;
while(*p2) /*删去字符'o'*/
{ if((2)) (3)=*p2;
p2++;
}
(4);
}
}
void main()
{
clrscr();
if(readdat())
{ printf("Can't open the file IN. DAT!\n");
return;
}
StrOR();
writedat();
}
int readdat(void)
{
FILE * fp;
int i=0;
char * p;
if((fp=fopen("in.dat","r" ))==NULL)
return 1;
while(fgets(xx[i],80, fp)!=NULL)
{ p=strchr(xx[i],'\n');
if(p)
*p=0;
i++;
}
maxline:(5);
fclose(fp);
return 0;
}
void writedat (void)
{ FILE * fp;
int i;
fp=fopen("in.dat',"w");
for(i=0;i<maxline;i++)
{ printf("%s\n",xx[i]);
fprintf(fp," %s\n",xx[i]);
}
fclose(fp);
}
}
}
用字符数组作函数参数编程,利用一个数组实现字符串(允许输入带空格的字符串)的逆序存放。要求如下: (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、File f=new File("d:\\abc\\x.txt"); Scanner cin=new Scanner(f);
B、File f=new File("d:\abc\x.txt"); Scanner cin=new Scanner(f);
C、File f=new File("d:/abc/x.txt"); Scanner cin=new Scanner(f);
D、File f=new File("d://abc//x.txt"); Scanner cin=new Scanner(f);
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!