题目内容

阅读以下说明和C语言程序,将应填入(n)处的字句写在对应栏内。
【说明】
Fibonacci数列A={1,1,2,2,5,8,…)有如下性质:
a0=a1=1
ai=ai-1+ai-2,i>1
对于给定的n,另外有一个由n个元素组成的数列xn,该数列中各元素的值为:
xi=ai/ai+1,i=0,1,…,n
现要求对xn中的元素按升序进行排序,然后以分数形式输出排序后的xn。例如n=5时,排序前的xn={1/1,1/2,2/3,3/5,5/8},排序后的xn={1/2,3/5,5/8,2/3,1/1}。程序中函数make()首先生成排序前的xn,然后调用函数sort()进行排序,最后输出所求结果。
【程序】
include <stdio.h>
include <stdlib.h>
include <malloc.h>
struct fact
{
long m,n;
};
void sort(int n,struct fact *p)
{
int a;
long s,t,u,v;
struct fact *q,*end;
for(end=p+(n-1),a=1;a;end--)
for(a=0,q=p;q<end;p++)
{
s=q->m;
t=q->n;
u=(q+1)->m;
v=(q+1)->n;
if((1) )
{
q->m=u;
(2)
(3)
(q+1)->n=t;
a=1;
}
}
}
void make(int n)
{
int i;
long a,b,c;
struct fact *x,*y;
x=(struct fact *)malloc(sizeof(struct fact)*n);
x->m=1:
x->n=1;
for(a=1,b=1,i=2;i<=n;i++)
{
(4)
a=b;
b=c;
(x+(i-1))->m=a;
(x+(i-1))->n=b;
}
(5)
printf("x%d={%1d/%1d",n,x->m,x->n);
for(y=x+1;y<x+n;y++)
printf(",%1d/%1d",y->m,y->n);
printf("}\n");
free(x);
}
void main()
{
int n;
printf("input n:");
scanf("%d",&n);
make(n);
}

查看答案
更多问题

听力原文:Katarina: So, Jatinder and Ali, how did you deal with culture shock when you first came here to study?
Jatinder: Well, Katarina, when I first arrived in the UK, I was just so excited to be living in a foreign country: away from my parents ... that I just didn't really notice anything at first. How about you, Ali?
Ali: Yeah. Same here. That's quite typical, isn't it? Everything seems new and fascinating. But, after this initial enthusiasm wears off, all the new experiences may begin to overwhelm you. Things that you found exciting at first may now seem strange and a little frightening. Even minor differences, such as being unable to buy your usual brands of various products, can add to the sense of strangeness.
Jatinder: Yes. That's right. Then you may start to experience sudden mood changes and strong reactions, feeling lost, disoriented, and even irritated and resentful. Most of all, you may wish you were back among the familiar people and places at home. All international students can experience culture shock in some form. ... even those coming from countries with very similar lifestyles to those in the UK. It is important to understand that this reaction is entirely normal and that it will pass.
Katarina: OK. So what suggestions do you have for me?
Ali: Well, I made sure that I arrived early. I got here about ten days, yeah, ten days before most of the other students, so that I could settle in before things got busy. Many universities run special induction programmes for international students in the week before term begins. A typical induction programme provides a tour of the college or university, an overview of its facilities and how to use them, help with registering for your academic programme, and social events where you can meet other students and staff. This can help you to start to get used to your new environment.
Katarina: Yeah, I heard about those ... but too late unfortunately. Jatinder, did you go on an induction course like Ali?
Jatinder: No. I wish I had, but my parents wouldn't let me go a day sooner than absolutely necessary. It was very annoying.
Ali: Every university has counsellors who can give you practical advice on adjusting to your new environment. These people have special training in offering advice and support, and they understand the challenges you face. They can listen to you sympathetically, offer practical suggestions, and refer you to other professionals if necessary. Your personal tutor and the staff in the international office of your college or university can also be helpful.
Jatinder: Have you heard about the 'buddy' or mentoring system? Students who have been at the university or college for a longer period give advice to new arrivals, and are available for help and guidance throughout the year. There is information on schemes such as these at the students' union or the international student association will help you become involved. I used the system when I arrived and found it really opened some doors socially: you know, I got to meet lots of people, like Ali, right?
Ali: Right! Katarina, I think that it's also important to keep in touch with home. Use the telephone, e-mail and conventional mail to keep in contact with your friends and family at home. In larger towns or cities with large international communities, like this one, you may be able to find people from your country. Spend some time with them. Many international students find that it helps to make contact with people from a similar background because they understand what you are going through. Spending time with people from your country can also be a relaxing break from the 'strangeness' of the UK. You can speak your own language, eat your own foods and talk about what is going on back home.
Jatinder: Yes. and don't forget that the university has a variety of cultural societies, as well as an active international students' association: ask at the student union. They may also have inform

阅读以下说明和Java代码,将应填入(n)处的语句写在对应栏内。
【说明】
本程序通过移动滑动条修改颜色RGB值,从而控制颜色。程序中有一个面板、3个标签和3个滑动条,标签和滑动条一一对应,分别对应三原色红、绿、蓝,任意拖动其中的一个滑动条,所对应的颜色值就会发生变化,面板的颜色也会发生对应的变化,如下图所示,滑动条值的范围是0~255。
【Java代码】
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class simple extends JFrame. implements AdjustmentListener{
public simple(){
setTitle("simple");
setSize(300, 200);
addWindowListener(new WindowAdapter(){
public void windowClosing((1)){
System.exit(0);
}
});
Container contentPane=getContentPane();
JPanel p=(2);
p.setLayout(new GridLayout(3, 2));
p.add(redLabel=new JLabel("Red 0"));
p.add(red=new JScrollBar(Adjustable. HORIZONTAL, 0, 0, 0, 255));
red.setBlocklncrement(16);
red.addAdjustmentListener(this);
p.add(greenLabel=(3) ("Green 0"));
p.add(green=new JScrollBar(Adjustable.HORIZONTAL 0, 0, 0, 255));
green setBIocklncrement(16);
green.addAdjustmentListener(this);
p.add(blueLabel=new JLabel("Blue 0"));
p.add(btue=new JScrollBar(Adjustable. HORIZONTAL, 0, 0, 0, 255));
blue,setBIocklncrement(16);
blue.addAdjustmentListener(this);
contentPane.add(p, "South");
colorPanet=new JPanel();
colorPanet.setBackground(new Color(0, 0, 0));
contentPane.add((4),"Center");
} public void adjustmentValueChanged(AdjustmentEvent evt){
redLabel.setText("Red"+red.getValue());
greenLabel.setText("Green"+green.getValue());
blueLabel.setText("Blue"+blue.getValue());
coiorPanel.setBackground(new Color(red.getValue(), green.getValue(), blue.getValue()));
colorPanel.repaint();
}
public static void main(String[] args){
JFrame. f=(5);
f.show();
}
private JLabel redLabel;
private JLabel greenLabel;
private JLabel blueLabel;
private JScrollBar red;
private JScroilBar green;
private JScrollBar blue;
private JPanel colorPanel;

Since rainforest bacteria and trees depend on cacti other for life, the relationship they

A—overpopulation B—under population
C—working population D—population waiting for employment
E—urban population F—rural population
G—population reproduction H—population increase
I—population decrease J—population base
K—population distribution L—population density
M—population quality N—population pyramid
O—population statistics P—population theory
Q—population studies
51. ()在业人口 ()人口密度
52. ()人口增长 ()人口年龄金字塔
53. ()城市人口 ()人口质量
54. ()人口理论 ()人口分布
55. ()待业人口 ()人口过剩

答案查题题库