- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
C++程序设计上机实践题.doc
2015 C++程序设计上机实践题
Chapter 1
熟悉VC的开发环境
熟悉编译、运行C++程序的基本过程。
Example:
#include iostream
using namespace std;
int main()
{
int a,b;
a = 627;
b = 365;
couta+b;
return 0;
}
Chapter 2
继续熟悉VC开发环境,能独立开发,编译,运行程序。
熟悉C++程序结构
编写程序理解declaration, variable, expression,, +的语法规则。
Arithmetic expression
Book p64-65 2,3,5,6,8
编程:定义两个Char型变量,分别赋值’a’,’b’。实现大小写字母转换,并输出,即变量输出值应为’A’,’B’。
Chapter 3
Type coercion and type casting
Function call
Output function
String function
P104-105 2,6,7,10,12
上机验证以下表达式的运算结果:
char a;
int b;
a = ‘2’; b = 3;
int c;
c = a +b;
// please print the value of a, b and c
float d;
d = float(c)/b;
//please print the value of b,c and d.
Chapter 4
Input from keyboard
File Operation
请完成以下程序,并测试运行结果
#include iostream
using namespace std;
int main ()
{
char char1;
char char2;
char char3;
char char4;
cout Input four characters. Press Return. endl;
//please use cin and to read four characters
cout char1 char2 char3 char4;
return 0;
}
请完成以下程序,并测试运行结果
#include iostream
using namespace std;
int main ()
{
char char1;
char char2;
char char3;
char char4;
cout Input four characters. Press Return. endl;
// please use get function to read four characters .
cout char1 char2 char3 char4;
return 0;
}
请输入不同的值,并测试运行结果
第一组值为:2 3 4回车 5 6 7回车20 30回车
第二组值为:2,3,4回车 5,6,7回车 20,30回车
#include iostream
using namespace std;
int main ()
{
cout inter the values as shown endl;
int a, b, c, d, e, f, g, h;
cin a b c;
cin.ignore(80, \n);
cin d e f;
cin.ignore(80, \n);
cin g h;
cout a a b b c c endl;
cout d d e e f f endl;
cout g g h h endl;
return 0;
}
Book P148 10,11
Book P149 2
Chapter 5
Rational and logical expression
BOOK P194-P195 2,3,7,10,11,12
Programming Problems Book P197 2
Programming Problems Book P198 8
有一函数
-1 (x0)
y={
您可能关注的文档
最近下载
- jtge20-2011公路工程沥青及沥青混合料试验规程.pdf VIP
- 露天矿采石场安全知识培训课件(插图80张).docx VIP
- 中国的文人与士大夫文化传统.pptx VIP
- 2024届高考作文主题训练偶然与必然(含解析) .pdf VIP
- 02-新型储能趋势:新型储能技术创新趋势分析.pdf VIP
- GB∕T3280-2024不锈钢冷轧钢板和钢带.pptx VIP
- 2025年三级中式烹调师(高级)职业技能鉴定参考试题库(含答案).docx VIP
- 商务英语视听说教程4(第2版)习题参考答案.pdf VIP
- 冰淇淋本部冷冻饮品生产工艺作业指.pdf VIP
- “多测合一”收费指导标准(示范文本) .pdf VIP
原创力文档


文档评论(0)