第一范文网 - 专业文章范例文档资料分享平台

C++面向对象程序设计教程(第3版)—-陈维兴,林小茶课后习题答案

来源:用户分享 时间:2025/6/3 4:46:32 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

#include #include using namespace std;

int main() {

char str[30];

fstream in(\, ios::in); if(!in) {

cout << \打开文件错误!\\n\; abort(); }

in >> str >> str;

for(int i = 0; i < 30; i++) {

if(str[i] != 0 && (str[i] < 'A')) {

str[i] += ('A' - 'a'); } }

fstream out(\, ios::out); if(!out) {

cout << \打开文件失败!\\n\; abort(); }

out >> str; (); ();

return 0; }

#include

#include using namespace std;

int main() {

char str[30];

fstream in(\, ios::in); if(!in) {

cout << \打开文件错误!\\n\; abort(); }

in >> str >> str;

for(int i = 0; i < 30; i++) {

if(str[i] != 0 && (str[i] < 'A')) {

str[i] += ('A' - 'a'); } }

fstream out(\, ios::app); if(!out) {

cout << \打开文件失败!\\n\; abort(); }

out >> str; (); ();

return 0; } 不会。

#include #include \ #include \

using namespace std;

class order {

private:

int orderID; int buyerID; int listcount;

string orderlist[20]; static int ordercount; public:

order(buyer &person, book &b[], int bookNumber) {

ordercount++;

orderID = ordercount; buyerID = ;

listcount = bookNumber;

for(int i = 0; i < bookNumber; i++) orderlist[i] = b[i].book_ID; }

void show() {

cout << \订单编号: \ << orderID << \购书人编号: \ << buyerID << \购书数量: \ << listcount << endl; for(int i = 0; i < listcount; i++)

cout << \书号: \ << orderlist[i] << endl;; } };

int order::ordercount = 0;

int main() {

book *c[20];

book c1(\, \程序设计\, \谭浩强\, \清华\, 25); book c2(\, \程序设计\, \谭浩强\, \清华\, 28);

c[1] = &c1; c[2] = &c2;

layfolk b1(\林晓茶\, 1, \北京\, 0); order ord(b1, c, 2); ();

return 0; }

C++面向对象程序设计教程(第3版)—-陈维兴,林小茶课后习题答案.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c0229v4ouax6et871df8g8njyy26yqz018h7_9.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top