皮皮学,免费搜题
登录
搜题
【简答题】
已知在文件IN99.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位)、产品名称mc(字符型10位)、单价dj(整型)、数量sl(整型)、金额je(长整型)几部分组成。其中,金额=单价×数量可计算得出。函数ReadDa()的功能是读取这100个销售记录并存入数组sell中。请编制函数SortDat(),其功能要求:按金额从小到大进行排列,若金额相同,则按产品代码从小到大进行排列,排列结果仍存入结构数组sell中,最后调用函数Writedat()把结果输出到文件OUT99.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 sl; long je; } PRO; PRO sell[MAX]; void ReadDat(); void WriteDat(); void SortDat() { } void main() { memset sell,0,sizeof(sell)); ReadDat(); SortDat(); WriteDat(); } void ReadDat() { FILE *fp; char str[80],ch[11]; int i; fp=fopen('IN99.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('OUT99.DAT','w'); for(i=0;i<100;i++) { fprintf(fp,'%s %s %4d %5d %101d/'.sell[i].dm,sell[i].mc,sell[i].dj,sell[i].sl,sell[i].je); } fclose(fp) }
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【单选题】Which of the following is NOT Sharon's advice on checking your credit scores?
A.
Keep a copy of your credit report.
B.
Show your partner the credit report.
C.
Try to know your credit score.
D.
Lock your credit report away.
【单选题】The painting is not a (n) ______ works; it is a copy.
A.
original
B.
crude
C.
true
D.
fresh
【单选题】在SE序列中,射频脉冲激发的特征是()
A.
a<90°< /div>
B.
90°-90°
C.
90°-180°
D.
90°-180°-180°
E.
180°-90°-180°
【单选题】介质隔离是以绝缘性能良好的电介质作为 “隔离墙”来实现电路中各元器件间彼此电绝缘的一种隔离方法。常用的电介质是
A.
多晶硅
B.
氮化硅
C.
二氧化硅
D.
【单选题】______ copy is not a good method for memory.
A.
Sientific
B.
Mechanical
【单选题】Which of the following is NOT true?
A.
After injection, the embryo gets a copy of the new gene as it divides.
B.
The injection method is less good because the new gene sometimes fails to join the embryo's genes.
C.
The retrovirus multiplies after it enters the cell.
D.
the incorporating method is less simple but better.
【简答题】肥胖病发生的主要诱因是( )。
【单选题】肥胖病发生的主要诱因是( )
A.
遗传因素
B.
过食、缺乏适当的体育锻炼
C.
内分泌疾患
D.
精神因素
【单选题】在SE序列中,射频脉冲激发的特征是
A.
90°—90°
B.
α<90°
C.
90°—180°
D.
90°—180°—180°
E.
180°—90°—180°
【单选题】Which of the following is NOT true?
A.
After injection, the embryo gets a copy of the new gene as it divides.
B.
The injection method is less good because the new gene sometimes fails to join the embryo's genes.
C.
The retrovirus multiplies after it enters the cell.
D.
The incorporating method is less simple but better.
相关题目:
【单选题】在SE序列中,射频脉冲激发的特征是()
关于我们
免责声明
版本记录
© 2019 pipixue.com 京ICP备20000060号-6