函数readDat()的功能是从文件IN22.DAT中读取20行数据存放到字符串数组xx中(每行字符串长度均小于80)。请编制函数jsSort(),该函数的功能是:以行为单位对字符串按下面给定的条件进行排序,排序后的结果仍按行重新存入字符串数组xx中,最后调用函数writeDat()把结果xx输出到文件OUT22.DAT中。
条件:从字符串中间一分为二,左边部分按字符的ASCII值降序排序,排序后,左边部分与右边部分按例子所示进行交换。如果原字符串长度为奇数,则最中间的字符不参加处理,字符仍放在原位置上。
例如, 位置 0 1 2 3 4 5 6 7 8
源字符串 a b c d h g f e
2 3 4 9 8 7 6 5
则处理后字符串 h g f e d c b a
8 7 6 5 9 4 3 2
注意:部分程序已给出。
请勿改动主函数main()、读函数readDat()和写函数writeDat()的内容。
inc lude〈 st dio. h>
inc lude〈 s t ring. h>
inc lude〈 conio, h>
char xx[20] [80];
void jsSort()
{
}
main ()
{
readDat ();
jsSort ();
writeDat ();
}
readDat ()
{
FILE *in;
int i=0;
char *p;
in= fopen("IN22.DAT", "r");
while(i〈 20 && fgets(xx[i], 80, in) != NULL)
{
p = strchr(xx[i], '\n');
if(p) *p = 0;
i++;
}
fclose(in);
}
writeDat ()
{
FILE *out;
int i;
clrscr ();
ut = fopen("OUT22.DAT", "w");
for(i = 0; i〈 20; i++)
{
printf("%skn", xx[i]);
fprintf(out, "%sin", xx[i]);
}
fclose(out);
}
One day I can hear the faint rustle of autumn coming. The next day I can’t. One evening summer leaks away into the cool night sky, but the next morning it’s back again. But there is headway. Birdsong has gone, and is【46】______ (replace) by a whining bag-piping of insect creation. I look out across the pasture as dusk【47】______(begin) and see a shining galaxy of airborne bugs. What would it be like, I wonder, to have an【48】aware______of the actual number of insects on this farm?
I ask myself a version of this question every day: "Have you ever really looked at…?”You can【49】______in the blank yourself.
Every day I am blinded by【50】familiar______. I open our beehive, which is filled with honey, and the particularity of the honeybees, and even of their community, somehow escapes me, if only because I’ve been living with honeybees a good part of my life. I remember the phrase, "keep your eyes【51】______ (peel) , ”and maybe that’s what I need, a good peeling.
Again and【52】______, I find myself trying to really look at what I' m seeing. It happened the other afternoon, high on a nearby mountain. A dragonfly had settled on the denuded tip of a pine bough. It clung, still as only a dragonfly can be. Then it flicked upward and caught a midge and settled on the bough again, adjusting【53】______(precise) to the wind. I see dragonflies【54】______ (quiver) in the insect clouds above my pasture, too. I am always aware, however , that there’s no such thing as really looking.
What I want to see is invisible anyway: the prehistoric depth of time embodied in the form. of those dragonflies, the pressure of life itself, the web of【55】______(relate) that bind us all together. I find myself trying to【56】wit______the moment when the accident of life becomes a continued purpose. But this is a small farm, and, being human, 1 keep【57】______(come) up against the limits of what a human can see.
This morning I found a spider resting—or perhaps hunting—on the leaf of a hydrangea, the axis of the spider’s abdomen perfectly aligned with the axis of the leaf. What I noticed was the symmetry of their placement, the way spider, and leaf resembled【58】_____other. What I wanted to determine was the spider’s intent. If I【59】c______, I would have asked it, "What are you doing?” Or, better yet, "Who are you?” But all I could do was look—and realizing that I was looking—make the【60】b______of what I’d seen.
(16)