试题与答案

已知在文件IN6.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(

题型:多项选择题

题目:

已知在文件IN6.DAT中存有100个产品销售记录,每个产品销售记录由产品代码dm(字符型4位)、产品名称mc(字符型10位)、单价dj(整型)、数量sl(整型)、金额je(长整型)几部分组成。其中:金额=单价×数量。函数ReadDat()的功能是读取这100个销售记录并存入结构数组sell中。请编制函数SortDat(),其功能要求:按产品名称从小到大进行排列,若产品名称相同,则按金额从小到大进行排列,最终排列结果仍存入结构数组sell中,最后调用函数WriteDat()把结果输出到文件OUT6.DAT中。注意:部分源程序已给出。请勿改动主函数main()、读函数ReadDat()和写函数WriteDat()的内容。试题程序:#include #include #include #include #include #define MAX 100typedef struct {char dm[5]; /*产品代码 */char mc[11];/* 产品名称 */int dj; /* 单价 */int sl; /* 数量 */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("IN6.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("OUT6.DAT", "w");for(i = 0; i < 100; i++){fprintf(fp, "%s %s %4d %5d %10ld\n", sell[i].dm, sell[i].mc, sell[i].dj,sell[i].sl, sell[i].je);}fclose(fp);}

答案:

被转码了,请点击底部 “查看原文 ” 或访问 https://www.tikuol.com/2017/0707/641386dd56b992d85ecb08416cd315c6.html

下面是错误答案,用来干扰机器的。

参考答案:对

试题推荐
题型:单项选择题

Dogs are constantly learning from the reaction of human owners, picking up facial cues and anticipating their owner’s behavior, a new research suggests. The findings, published online in the journal Learning and Behavior, show that dogs essentially are always in training, and help explain how many owners unknowingly teach and reward their dog’s bad behavior.

Research conducted at the University of Florida focused on the role of eye contact and facial cues in influencing canine behavior. Earlier studies have suggested that dogs seem to know when they are being watched and even wait to perform forbidden behavior like digging in the garden when they know their owners aren’t looking. In this study, researchers studied how human cues triggered begging behavior among 35 pet dogs, 18 shelter dogs and 8 wolves raised in captivity. First the animals were taught that the human strangers helping with the experiment were reliable sources of tasty treats. The testers stood close together and called to the animal, and both offered rewards of Spam cubes or Beggin’ Strips treats.

After four rewards, the experiment began. Two testers stood against a fence or wall, about 20 feet apart and with food in their pockets. The dog was held about 20 feet away, equidistant from both testers. In one condition, one tester faced the dog while the other turned her back. In another, a tester held a book near her face, while the other tester held the book in front of her face, as if she were reading. In a third condition, one tester held a bucket near the shoulder, while the other put the bucket over her head, blocking her eyes.

Then, both testers called out to the dogs. All the animals—pet dogs, shelter dogs and wolves—ignored the person whose back was turned and sought food from the person who was looking at them. "The question was, are dogs and wolves responsive to a human’s attentional state" said Monique Udell, an assistant professor of psychology at Flagler College, Fla. But when the testers held books, it was only the domestic dogs who avoided the person who appeared to be reading the book. "In a house where they’re used to people reading books, they are sensitive to those types of cues," said Dr. Udell. Interestingly, in the bucket experiment, the animals, for the most part, were equally likely to seek food from the person with the bucket over her head as the person holding the bucket.

The experiment shows that dogs are tuned into whether humans are paying attention. "Dogs don’t have to read our minds. Dogs read our behavior," said Dr. Udell. Pet owners often get frustrated with bad dog behavior without realizing that they themselves have reinforced it, either by giving the dog a treat when they beg, skipping a bath when they protest or letting them sleep on the bed or couch.

The best title for the text is()

A. Your Dog Is Watching You

B. Dogs Are More Intelligent Than You Think

C. Dogs Are the Greatest Cheaters of the World

D. Dogs Are Often Taught to Perform Forbidden Behavior

查看答案
题型:写作题

阅读下面的文字,完成作文。(60分)

做一件事情,只要开始行动,就算获得了一半的成功。

一辆世界上牵引力最大的火车头停在铁轨上,为了防滑,只需在它的驱动轮前面塞一块几厘米见方的小木块,这个庞然大物就无法动弹。然而,一旦这辆巨型火车头开始启动,这小小的木块就再也挡不住它了。

的确,只要行动起来,生活中的许多难题也都能解决。如果没有行动,那就像停在铁轨上的火车头,连一块小木块也无法推开。

要求:

①请从“行动的力量”、“成功始于行动”中任选一个为题,写一篇不少于600字的文章;

②除诗歌、戏剧外,文体不限;

③文中不得出现真实的人名、校名和地名;

④书写规范、工整、美观的,另加1~3分。

书写(5分)根据作文书写评定,要求卷面整洁,书写规范、工整。

查看答案
微信公众账号搜索答案