【程序说明】 下列文法可用来描述化学分子式的书写规则(例如,A12(C03)、Cu(OH)2): λ→β|βλ β→δ|δn δ→ξ|ξθλ 其中,λ是一个分子式;δ或是一个元素,或是一个带括号的(子)分子式,元素或是一个大写字母(记为ξ),或是一个大写字母和一个小写字母(记为ξθ);β或是一个δ,或是在δ之后接上一个整数n,δn表示β有n个δ的元素或(子)分子式。一个完整的分子式由若干个β组成。 当然一个正确的分子式除符合上述文法规则外,还应满足分子式本身的语义要求。下面的程序输入分子式,按上述文法分析分子式,并计算出该分子式的分子量。例如,元素H的原子量是1,元素O的原子量是16。输入分子式H2O,程序计算出它的分子量为重18(1×2+16)。程序中各元素的名及它的原子量从文件atom.dat中读入。 【程序】 #include <stdio.h> #include <string.h> #define MAXN 300 #define CMLEN 30 struct elem{ char name[3];/*元素名*/ double v; /*原子量*/ }nTbl[MAXN]; char cmStr[CMLEN], *pos; int c; FILE *fp; double factor(); double atom() /*处理文法符号δ*/ { char w[3]; int i; double num; while((c = *pos++)=="|| c==’\t’); /* 略过空白字符 */ if(c==’\n’) return 0.0; if(c>=’A’ && c<=’Z’){/* 将元素名存入W*/ w[i=0]=c; c=*pos++; if(c>=’a’ && c<=’z’) w[++i]=c; else pos--; w[++i]=’\0’; for(i=0; nTbl[i].v>0.0; i++) if(strcmp(w, nTbl[i].name)==0) return nTbl[i].v; printf("\n 元素表中没有所输入的元素: \t%s\n",w); return -1.0; } else if(c==’(’){ if((num = (1) <0.0)return -1.0; /* 包括可能为空的情况 */ if(*pos++ !=’)’){ printf(" 分子式中括号不匹配!\n"); return -1.0; } return num; } printf("分子式中存在非法字符: \t%c\n",c); return -1.0; } double mAtom() /* 处理文法符号β*/{ double num; int n=1; if((num = (2) )<0.0) return -1.0; c = *pos++; if(c>=’0’&& c <=’9’){ n=0; while(c>=’0’ && c<=’9’){ n= (3) ; c=*pos++; } } pos--; return num *n;}double factor() /* 处理文法符号λ */{ double num=0.0, d; if((num=mAtom())<0.0) return -1.0; while(*pos>=’A’ && *pos<= ’Z’ || *pos==’(’){ if((d= (4) <0.0) return -1.0; } return num;}void main(){ char fname[]="atom.dat"; /*元素名及其原子量文件*/ int i; double num; if((fp=fopen(fname, "r"))==NULL){/* 以读方式打开正文文件*/ printf("Can not open %s file.\n", fname); return;/* 程序非正常结束 */ } i=0; while(i<MAXN && fscanf(fp, "%s%lf", nTbl[i].name, &nTbl[i].v) == 2)i++; fclose(fp); nTbl[i].v=-1.0; while(I){ /* 输入分子式和计算分子量循环,直至输入空行结束*/ printf ("\n 输入分子式!(空行结束)\n"); gets(cmStr); pos=cmStr; if(cmStr[0]==’\0’)break; if((num=factor())>0.0) if (*pos != ’\0’)printf("分子式不完整!\n"); else printf(" 分子式的分子量为 %f\n", num); }}
查看答案
Most people enjoy watching a quality film at home or in the theater. The movie industry reaps billions of dollars each year from this popular hobby. But instead of merely following the story line, check out the contributing elements that make a good film superior to others. Before you know, you will be thinking like a film critic! 1) Plot. A solid film offers a story arc. That means that conflict is introduced and increases tensions to a building point at which a cataclysmic event occurs, followed by a return to normal. If the plot does not contain a noticeable arc, the story may not hold viewers’ attention. A dilemma should make the audience care about the outcome. 2) Actors. A good performer will bring his or her role to life. That may mean studying the role ahead of time rather than just learning the lines. It may include visiting sites or people-types associated with the theme of the film, such as a psychiatric hospital or a political campaign office. An actor may need to practice an accent or dialect several weeks before getting it right, or sculpting his or her body to get it in shape for an important part. If the actor appears to fit a role, the audience will appreciate the film even more. 3) Tensions. A conflict-laced story can keep viewers on the edge of their seats. Even love stories need squabbles, threats, or deceit to keep us interested in the plot. The next time you watch a film, see if you can find several types of conflict that help to move the plot forward. Films thrive on it; audiences love it. 4) Cinematography: Photography, scene set-ups, backdrops, and locations add artistic and aesthetic value to a film. A professional photographer and expert camera hands can turn even a mediocre plot into an award-eligible nomination. Study the backdrop of an historic or romantic film especially to get the effect of settings, props, and scenery. 5) Theme music. Classic films get their own musical score, often written and produced by award winning composers. The theme song may introduce and conclude the film, as well as appear sporadically throughout. In other types of movies, a string of songs from a particular time period or music style may grace the acting to add a powerful element of beat and rhythm. Many theme songs have made the top ten music lists over the years. 6) Director and producer. These people, sometimes the same person, are responsible for choosing actors, approving the script, and coordinating all the production elements like camera shots, scene speeches, and action sequences as well as special effects, if any. The producer may be the person who bankrolls the film or lines up investors. Without these persons, there would be no film. Watching a movie can be fun and relaxing. Paying attention to the contributing elements can enrich the viewing experience. Look for some of them in the next film you see; your viewing experience will never be the same! The best title for this passage is ______.
A. How to Appreciate a Quality Film
B. How to Think like a Film Critic
C. What Is a Good Film
D. The Making of a Film
Before talking about what forensic and criminal psychology is, we must define criminal behavior first. Criminal behavior suggests a large number and variety of acts. Andrew and Bonta (1998) suggest four broad definitions of criminal behavior and the acts and behaviors that fit within these domains. These four areas are legal criminal behavior or actions that are prohibited by the state and punishable under the law, moral criminal behavior which refers to actions that violate the norms of religion and morality and are believed to be punishable by a supreme spiritual being, social criminal behavior which refers to actions that violate the norms of custom and tradition and are punishable by a community and finally psychological criminal behavior that refers to actions that may be rewarding to the actor but inflict pain or loss on others--it is criminal behavior that is anti-social behavior. A good working definition can be seen as. "antisocial acts that place the actor at risk of becoming the focus of the attention of the criminal and juvenile professionals (Andrews and Bonta, 1998). It is difficult to define criminal behavior as ideas of what is considered immoral, unconventional, illegal or antisocial as it is not stable over time or place. For example, not wearing seatbelt, homosexual activity or spanking a child are all items that have been considered either illegal or legal at one point in time. Delinquency must be distinguished from criminality. Delinquency is defined as behavior that is illegal, immoral or deviant with respect to societal values. Criminality on the other hand is defined as a breaking of existing laws, there is little or no confusion as to what constitutes illegal and legal behaviors, When measuring criminal behavior we are trying in a way to predict future criminal behaviors. We may measure criminal behavior by arrests and charges, however not everyone charged is found guilty. We can also measure the amounts of convictions and incarcerations. We can also measure the amount of self-reported offences and some believe that this may be a more accurate way to measure criminal behavior. This is debatable as there may be reasons that the individuals participating in the anonymous self-report surveys may distrust that their responses are anonymous. As well, individuals may over-or underestimate their crimes for personal reasons. Therefore, when we study criminal behavior we typically study what is known about persons who have been defined as criminals through the criminal justice system. Estimates of actual crime rates are usually obtained from official sources, yet different sources may yield different estimates. Crime reports generally categorize crimes by type of crime and offender characteristics such as age, gender, race and location. Why do we only study those criminals defined by the criminal justice system
A. Because those arrested or charged may found not to be guilty.
Because self-report people may inaccurately estimate their crimes.
C. Because the criminal justice system is able to distinguish between criminality and delinquency.
D. Both A and B.
材料7集中介绍了国外井盖管理的做法。这些做法,为我们提供了哪些有益的启示不超过250字。
下列各项中,关于总包和分包的说法不正确的有( )。
A. 建设工程实行总包和分包的,由总包单位负责施工现场的统一管理,监督检查分包单位的施工现场活动
B. 建设工程实行总包和分包的,由总包单位负责编制施工组织计划或者分阶段施工组织计划
C. 分包单位应在总包单位的统一管理下,在其分包范围内建立施工现场管理责任制,并组织实施
D. 建设单位有要求的,总包单位应当接受其委托,负责协调该施工现场内由建设单位直接发包的其他单位的施工现场活动