题目内容

[说明] 本程序实现对指定文件内的单词进行计数。其中使用二叉树结构来保存已经读入的不同单词,并对相同单词出现的次数进行计数。此二叉树的左孩子结点的字符串值小于父结点的字符串值,右孩子结点的字符串值大于父结点的字符串值。函数getword(char *filename,char*word)是从指定的文件中得到单词。char* strdup(char* s)是复制s所指向的字符串,并返回复制字符串的地址。 [函数] #include <stdio. h> #include<ctype. h> #include <string.h> #define MAXWORD 100 struct node char *word; int count; struct node *left; struct node *right; struct node *addtree(struct node *p,char *w) int cond; if (p==NULL) /*向树中插入结点*/ p=(struct node*) malloc(sizeof(struct node)); p->word=strdup (w); p->count=1; (1) ; else if((cond=strcmp (w,p->word))==0) (2) ; else if (cond<0) p->left= (3) ; else p->right= (4) ; return p; main() struct node *root; char word [MAXWORD]; root=NULL; filename="example .dat"; while getword(filename,word)! =EOF root= (5) ;

查看答案
更多问题

消费者组织有权对消费者与经营者之间的争议依法做出裁决。( )

A. 对
B. 错

Bipolar disorder has four types because ______ show up differently in different people.

Hotels were among the earliest facilities that bound the United States together. They were. both creatures and creators of communities, as well as symptoms of the frenetic quest for community. Even in the first part of the nineteenth century, Americans were private, business and pleasure purposed. Conventions were the new occasions, and hotels were distinctively American facilities making conventions possible. The first national convention of a major party to choose a candidate for President (that of the National Republican party, which met on December 12, 1831, and nominated Henry Clay for President) was held in Baltimore, at a hotel that was then reputed to be the best in the country. The presence of Barnum’s City Hotel in Baltimore, a six-story building with two hundred apartments helps explain why many other early national political Conventions were held there. In the longer run, too. American hotels made other national conventions not only possible but pleasant and convivial. The growing custom of regularly assembling from afar the ’representatives of all kinds of groups—not only for political conventions, but also for commercial, professional, learned, and. vocational ones—in turn supported the multiplying hotels. By mid-twentieth century, conventions accounted for over third of the yearly room occupancy of all hotels in the nation, about eighteen thousand different conventions were held annually with a total attendance of about ten million persons. Nineteenth-century American hotelkeepers, who were no longer the genial, deferential "hosts" of the eighteenth-century European inn, became leading citizens. Holding a large stake in the community, they exercised power to make it prosper. As owners or managers of the local "palace of the public", they were makers and shapers of a principal community attraction. Travelers from abroad were mildly shocked by this high social position. Which of the following statements about early American hotels is NOT mentioned in the passage

A. Travelers from abroad did not enjoy staying in them.
B. Conventions were held in them.
C. People used them for both business and pleasure.
D. They were important to the community.

What can we learn from the conversation

A. He doesn’t care flit is turned off.
B. He thinks the woman is right.
C. He is reluctant to mm it off.
D. He wants the woman to watch the game, too.

答案查题题库