实验报告 第四次作业.docx学生实验报告
学生姓名
学号
同组人
实验项目
口必修 □选修 口演示性实验□验证性实验 □操作性实验 □综合性实验
实验地点
学校机房
实验仪器台号
52
指导教师
实验日期及节次
2011. 9. 29. 34 节
一、实验综述
1、实验目的及要求
Before you enter the following program in the computer, please point out the errors of it, then analyze and correct the errors.
ttinclude <iostream. h>
int n;
void main ()
(
double m=3. 8;
cout〈<〃n=〃<〈n〈〈endl;
fn();
}
void fn()
(
cout<<zzm=,/<<m<<endl;
cout〈<〃n=〃<〈n〈〈endl;
}
Before you enter the following program in the computer, please read it and write down the output results of the program. Then, you can test the results in the computer by compiling and running it in VC++.
ttinclude <iostream. h> void func ();
int n=l;
int main()
{
static int x=5;
int y;
y=n;
cout<〈〃x二〃<<x++〈<〃,y=/,«++y«/,, n=,,«n«endl;
func ();
cout<〈〃x二〃<<x++〈<〃,y=/,«++y«/,, n=,,«n«endl;
func ();
}
void func ()
(
static int x=4;
int y=10;
x+二 3;
n+二10;
y+=n;
cout<<〃x二〃y=〃n=,/<<n<<endl;
}
Before you enter the following program in the computer, please give the results of the following program of Macros. Then, you can test the results in the computer by compiling and running it in VC++.
ttinclude <iostream. h>
ttdefine f(x) x*x
void main ()
(
cout<<f(4+4)<<endl;
cout<<f(2+2)<<endl;
cout<<f (4+4)/f(2+2)<<endl;
}
Based on the following namespace and what we have learned about namespace, please use two or three dif
实验报告 第四次作业 来自淘豆网www.taodocs.com转载请标明出处.