-
one
实验1 C++基础编程
实验目的
? 掌握VC++ 6.0进行程序设计的基本步骤。
? 学会在VC++ 6.0环境下进行简单C++程序设计。
? 掌握new和delete的用法。
? 熟练使用string类处理字符串。
? 重点掌握函数的参数传递方式、函数重载、函数默认值的实现。
实验学时
本次实验需要2个学时。
实验要求
? 实验上机之前,根据实验内容要求,自行设计编写程序,完成预习报告。
? 实验上机时调试并修正程序。
? 当次上机结束前分析错误原因并给出实验结论,提交实验报告。
实验内容
1.基础部分
(1)动态分配保存10个成绩数组的存储空间,并对成绩进行输入,求出最高分并输出,用new和delete。
{
double*pd=new double [10];
double k;
for(int i=0;i<10;i++)
cin>>pd[i];
for(int j=0;j<9;j++)
{
if(pd[j]>pd[j+1])
{
k=pd[j];
pd[j]=pd[j+1];
pd[j+1]=k;
}
if(j==8)
cout<<pd[j+1]<<endl;
}
system("pause");
return 0;
}
(2).定义函数,实现两个变量的交换(用传递指针和传递引用的方式分别实现),并对比区别。
(4).上述第(3)题,如果希望给形参默认值,如a=1,b=2,c=3,该如何修改和如何调用?(Experiment 1 C++ Basic Programming Experimental purpose Grasp the basic steps of VC++ 6.0 programming. Learn to design simple C++ programs in the environment of VC++ 6.0. Master the usage of new and delete. Proficiency in string class processing. Emphasis is laid on how to transfer function parameters, how to overload function and how to realize default value of function. Experimental hours This experiment needs two hours. Experimental requirements Before the experiment is put on the computer, according to the requirement of the experiment content, the program is designed and written by oneself, and the preview report is completed. Debug and correct the program when the experiment is on the computer.)
- 2019-05-01 14:56:42下载
- 积分:1
-
W10 Certification C# version 2.7
Win10 开源破解,无马,放心使用。凑够20字了吗(WIn10 certification)
- 2019-06-27 11:51:04下载
- 积分:1
-
STM32_SPI
STM32 SPI口的应用例程,可是设置成主模式或者从模式。(STM32 SPI routine application of the mouth, but set to master mode or slave mode.)
- 2008-04-23 13:50:49下载
- 积分:1
-
nsga2code
多目标进化算法NSGA2的c++源代码,需要自习阅读代码的注释,要执行程序要在源代码内添加目标函数和约束条件。(Multi-Objective Optimization Using NSGA-II)
- 2009-04-23 22:16:54下载
- 积分:1
-
wuziguanlixitong
物资管理系统,很好的,大家下载了就知道好用了(Materials management system, very good, everyone will know downloaded a useful)
- 2008-04-16 22:41:55下载
- 积分:1
-
turboC
turb0c的使用说明,其中详细阐述了该集成开发环境的使用方法(turb0c' s instructions, which detail the use of integrated development environment)
- 2011-01-26 10:25:06下载
- 积分:1
-
Delaunay
说明: 基于opencv的Deluanay抛分算法,可以实现点到面的扩散(Opencv of Deluanay throw points based algorithms, can point to the proliferation of surface)
- 2011-03-23 10:10:38下载
- 积分:1
-
MSP430-ADTLC5491
说明: 利用C语言实现MSP430单片机对TLC5491A/D的数据采集(Using C language to realize MSP430 Singlechip TLC5491A/D data acquisition)
- 2008-09-23 07:46:22下载
- 积分:1
-
frmGoodsReturn.designer
说明: Quan-l-trung-t-m-ti-ng-anh-master
- 2020-06-25 05:20:02下载
- 积分:1
-
STM32F103 UCOSII
STM32F103 UCOSII 控制,后续上传UCOSII+UIP移植模板
- 2022-06-27 12:30:35下载
- 积分:1