云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > C++面向对象程序设计教程(第3版)—-陈维兴,林小茶课后习题答案

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

  • 62 次阅读
  • 3 次下载
  • 2025/5/6 9:11:53

#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; }

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

#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] +=

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com