第1题
Which of the following situation will not bring price up?
A.The shortage of goods
B.The decrease of the money's value
C.The increase of demand for goods
D.The input of more money to the market
第2题
What is one of factors that affect global trade growth?
A.The value of world merchandise trade.
B.The slower growth in Western Europe in early 1999.
C.The low expansion of input in Latin America.
D.The stagnation in world exports of services.
第3题
Which of the following situation will not bring price up?
[A] The shortage of goods
[B] The decrease of the money's value
[C] The increase of demand for goods
[D] The input of more money to the market
第4题
#include"stdio.h"
#defineTRUE 1
#defineFALSE 0
#define SQ(x)(x)*(x)
voidmain()
{
intnum;
int again=1;
printf("Program will stop if input value less than 50.\n");
while(again)
{
printf("Please input number==>");
scanf("%d",&num):
printf("The square for this number is%d\n",SQ(num));
if(num>=50)
again=TRUE;
else
again=FALSE;
}
第6题
函数
1.实验目的
①掌握定义函数的方法。
②掌握函数实参与形参的对应关系以及“值传递”的方式。
③掌握甬数的嵌套调用和递归调用的方法。
④掌握全局变量和局部变量、动态变量和静态变量的概念和使用方法。
⑤学习对多文件程序的编译和运行。
2.实验内容
编程序并上机调试运行。
①已有变量定义和函数调用语句int a=1,b=-5,c; c=fun(a,b);fun函数的作用是计算两个数之差的绝对值,并将差值返回调用函数,请编写fun函数。
Fun(int x,int y)
{ }
②有函数调用语句c=add(a,b);请编写add函数,计算两个实数a和b的和,并返回和值。
double add(double x,double y)
{ }
③利用递归方法求5!。
④利用递归函数调用方式,将所输入的5个字符,以相反顺序打印出来。
⑤有5个人坐在一起,问第五个人的岁数,他说比第四个人大2岁。问第四个人岁数,他说比第三个人大2岁。问第三个人,叉说比第二个人大两岁。问第二个人,又说比第一个人大两岁。最后问第一个人,他说是10岁。请问第五个人多大?
程序分析:利用递归的方法,递归分为回推和递推两个阶段。要想知道第五个人的岁数,就需知道第四人的岁数,依次类推,推到第一人(10岁),再往回推。
⑥以下程序运行后输入:3,abcde<回车>,则输出结果是______。
#include
move(char*str,int n)
{char temp;int i;
temp=sTR[n-1];
fOr(i=n-1;i>0;i--)str[i]=str[i-1];
str[0]=temp;
}
main()
{chaR s[50];int n,i,z;
scanf("%d,%s",&n,&s);
z=strlen(s);
for(i=1;i<=n;j++)
move(s,z);
printf("%s\n",s);
}
⑦编写函数求:1-1/2+1/3-1/4+1/5-1/6+1/7-…1/n
⑧编程输出如下图形,
即一个由*组成的正六边形,注意是空心的。
3.理解变量的作用范围
①学习static定义静态变量的用法。
#include"stdio.h"
varfunc()
{
int var=0;
static int static_var=0;
printf("\40:var equal%d\n",var);
printf("\40:static var equal%d\n",static_var);
printf("\n");
var++;
static_var++;
}
voidmain()
{inti;
for(j=0;i<3;i++)
varfunc();
}
②学习使用auto定义变量的用法。
#include"stdio.h"
main()
{inti,num;
num=2;
for(i=0;i<3;i++)
{ printf("\40:The num equal%d\n",num);
num++;
{
auto int num=1;
printf("\40:The internal block num equal%d\n",num);
num++;
}
}
}
③学习使用static的另一用法。
#include"stdio.h"
main()
{
inti,num;
num=2
for(i=0;i<3;i++)
{
printf("\40:The hum equal%d\n",num);
num++;
{
static int num=1;
printf("\40:The internal block hum equal%d\n",hum);
num++;
}
}
}
④学习使用external的用法。
#include"stdio.h"
int a,b,c;
void add()
{int a;
a=3;
c=a+b
}
voidmain()
{ a=b=4;
add();
printf("The value of c is equal to%d\n",c);
}
⑤学习使用register定义变量的方法。
voidmain()
{
register int i;
int tmp=0:
for(i=1;i<=100;i++)
tmp+=i;
printf("The sum is%dha",tmp);
}
(6)宏#define命令练习(1)
#include"stdio.h"
#defineTRUE 1
#define FALSE 0
#define SQ(x)(x)*(x)
voidmain()
{
int num;
int again=1;
printf("\40:Program will stop if input value less than 50.\n");
while(again)
{
printf("\40:Please input number==>");
scanf("%d",&num);
printf("\40:The square for this number is%d\n",SQ(num));
if(num>=50)
again=TRUE;
else
again=FALSE;
}
}
第7题
第9题
第10题