In developing the design, ___________________________ (这位工程师必须运用工程学的知识).
查看答案
已知文件IN21.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位)、产品名称mc(字符型10位)、单价dj(整型)、数量s1(整型)、金额je(长整型)几部分组成。其中:金额 =单价×数量。函数ReadDat()的功能是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品名称从大到小进行排列,若产品名称相同,则按金额从小到大进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT21.DAT中。 注意:部分源程序已给出。 请勿改动主函数main()、读函数ReadDat()和写函数WriteDat()的内容。 试题程序: #include 〈stdio.h> #include 〈mem.h> #include 〈string.h> #include 〈conio. h> #include 〈stdlib.h> #define MAX 100 typedef struct char dm[5]; /* 产品代码 */ char mc[11]; /* 产品名称 */ int dj; /* 单价 */ int si; /* 数量 */ long je; /* 金额 */ PRO; PRO sell [MAX]; void ReadDat (); void WriteDat(); void SortDat() main ( ) memset(sell, 0, sizeof(sell)); ReadDat (); SortDat (); WriteDat (); void ReadDat () FILE *fp; char str[80], ch[11]; int i; fp = fopen("IN21.DAT", "r"); for(i=0; i〈100; i++) fgets(str, 80, fp); memcpy(sell[i].dm, str, 4); memcpy (sell [i] .mc, str + 4, 10); memcpy(ch, str+ 14, 4); ch[4] = 0; sell[i] .dj = atoi(ch); memcpy(ch, str +18, 5); ch[5] = 0; sell[i].sl = atoi(ch); sell[i].je = (long) sell[i].dj * sell[i] .sl; fclose (fp); void WriteDat() FILE *fp; int i; fp = fopen("OUT21.DAT", "w"); for(i = 0; i 〈 100; i++) fprintf(fp, "%s %s %4d %5d %101d\n", sell[i].dm, sell[i].mc, sell[i].dj, sell[i].sl, sell[i].je); fclose (fp);
We called him our Christmas Boy because he came to us during that season of joy, _____________(当时他生下来才六天).
Passage OneQuestions 26 to 28 are based on the passage you have just heard.
A. Purple.
B. Red.
C. Blue.
D. Green.
Passage OneQuestions 26 to 28 are based on the passage you have just heard.
A. Personal matters.
B. Social problems.
C. Family planning.
D. Family relations.