题目内容

试述领导绩效考评的程序。

查看答案
更多问题

Linux的一项最大特点在于______完全公开。

【说明】 单击窗体上的“测试”(cmdTest)按钮,出现一个输入框,要求输入一串字符,将该字符串中的非字母字符删除后,显示在窗体中的一个文本框(txtShow)中。 【程序代码】 Private Sub cmdTest_Click( ) Dim strT1 ,strT2 As String Dim strCh As (1) Dim intL As Integer Dim intl As Integer strT1 = (2) ("请输入一串字符","字符串输入") intL = (3) strT2 = " " For intl = I To intL strCh = Mid ( strT1, intl, 1 ) If(strCh>"A"And (4) ) Or (strCh >"a" And suCh <"z" )Then strT2 = strT2 + strCh End If Next intl txtShow. Text= (5) End sub

Christmas is coming. It is celebrated(庆祝) every year on December 25 and it is the most celebrated holiday in the world. It is celebrated in Europe, North America, South America and in every country that has been touched by western culture. Christmas celebrates the birth of Jesus Christ. Today, most people who celebrate Christmas are not Christians(基督徒). They celebrate the holiday because Christmas is an opportunity for people to show the "good feelings" they have for each other. Christmas is called "the season of giving". It is the time of year when people give gifts to others to show how much they love them or just to show how much they appreciate(感激) them. We give gifts to our family and we also give gifts to close friends. Many people also give gifts to people who have performed services for them through the year, like the postman or the cleaner. And Christmas is the time of year we remember that many people are less fortunate than us: the poor, the sick and the lonely; and we try to help them in any way we can. Postmen and cleaners don’t work on Christmas.

A. Right.
B. Wrong.
C. Doesn’t say.

【说明】 本程序从若干个原始文件合并成的合并文件中恢复出其中一个或全部原始文件。所有文件均作为二进制文件进行处理。合并文件中先顺序存储各原始文件,然后顺序存储各原始文件的控制信息,即文件名、文件长度和在合并文件中的位置(偏移量)。其结构为: typedef struct {char fname [256] /*原始文件名*/ long length; /*原始文件长度(字节数)*/ long offset; /*原始文件在合并文件中的位置(偏移量)*/ }FileInfo; 在合并文件最后存储如下一个特殊的标志信息作为合并文件的结束标记: FileInfo EndFlag={"Combined File",0,_offset}; 其中_offset是第一个原始文件的控制信息在合并文件中的位置(偏移量)。 启动本程序的命令行的格式是: 程序名 合并文件名 [原始文件名] 如果不指定原始文件名,默认恢复合并文件中的所有原始文件。 程序中涉及的部分文件操作的库函数简要说明如下: int fread(void * buffer,int size,int count,FILE * fbin):从二进制文件流fbin中读取 count块长度为size字节的数据块到buffer指向的存储区。返回值为实际读取的数据块数。 int fwrite(void * buffer,int size,int count,FILE * fbin):各参数和返回值的意义与fread相同,但对文件进行写操作。 int fseek(FILE * fbin,long offset,int position):将文件流fbin的读/写位置以position为基准移动offset字节。position的值可以是SEEK_SET(文件头),SEEK_CUR(当前位置), SEEK_END(文件尾);offset为正,表示向文件尾方向移动,为负表示向文件头方向移动,为零表示到基准位置。 long ftell(FILE * fbin):返回文件流fbin的当前读/写位置(相对于文件头的偏移量)。上述偏移量均以字节为单位,即偏移字节数。 【程序】 #include <stdio. h> #include <string. h> typedef struct { char fname[256];long lengt;long offset; } Filelnfo; void copyfile( FILE*fin, FILE * fout,int fsize) { char buf[1024];int siz=1024; while(fsize !=0){ /*每次复制siz个字节,直至复制完fsize个字节*/ if(siz >fsize) (1) ; fread(buf,1,siz,fin); fwrite(buf,1,siz,fout); fsize= (2) ;} } int dofile(FILE * fin,Filelnfo * inp) { long offset; FILE * fout; if (( fout = fopen ( inp - > fname ,"wb" ))==NULL) { printf("创建文件错误: %s\n" , inp -> fname); return 1; } offset= (3) ; /*保留合并文件读/写位置*/ fseek( (4) ); /*定位于被恢复文件首*/ copyfile ( fin, fout, inp - > length); fclose(fout); printf("\n ---文件名: %\n 文件长: %ld. \n",inp -> fname, inp -> length); (5) ; /*恢复合并文件读/写位置*/ return 0; } int main( int argc, char * argv[ ]) { Filelnfo finfo; char fname[256] ;FILE * fcmbn; if(argc <2) { printf("输入合并文件名:" ) ;scanf("%s" ,fname); else strcpy(fname,argv[1]); if((fcmbn = fopen(fname,"rb" )) == NULL) { printf("文件打开错误: %s\n" ,fname);return 1; } fseek(fcmbn, -sizeof(Filelnfo),SEEK_END); /*定位于合并文件末尾的标志信息*/ fread(&finfo,1,sizeof(Filelnfo) ,fcmbn); if(finfo. length!=0||strcmp(finfo. fnane," CombinedFile" )){ printf("指定的文件不是合法的合并文件\n"); fclose (fcmbn); return 2; } fseek(fcmbn,finfo. offset,SEEK_SET); /*定位于首个原始文件的控制信息*/ for(;;){ /*恢复一个(argc>2)或全部(argc=2)原始文件*/ fread ( &finfo,1, sizeof (Fitelnfo), fcmbn); if(finfo, length ==0) break; if (argc> 2 && strcmp(finfo. fname,argv[2] )) continue; if (dofile ( fcmbn, &finfo)!=0) break; } fcolse(fcmbn);return 0; }

答案查题题库