数学是一门为不同事物起相同名字的艺术,从这点看英语是有多笨拙--------------
13-1#pragma once
#ifndef CD_H_
#define CD_H_
class Cd {
private:char performers[50];char label[20];int selections;double playtime;
public:Cd(const char* s1, const char* s2, int n, double x);Cd(const Cd& d);Cd();virtual ~Cd();virtual void Report() const;Cd& operator=(const Cd& d);
};
class Classic :public Cd {
private:char name[20];
public:Classic(const char* s1, const char* s2, const char* s3, int...
12-1//hf
#pragma once
#ifndef COW_H_
#define COW_H_
class Cow {
private:char name[20];char* hobby;double weight;
public:Cow();Cow(const char* nm, const char* ho, double wt);Cow(const Cow& c);~Cow();Cow& operator=(const Cow& c);void ShowCow() const;
};
#endif // !COW_H_
//rf
#include "pch.h"
#include <iostream>
#include <cstring>
#include "cow.h"
using namespace std;
Cow::Cow() {name[0] = \0;hobby ...
1 const unsigned int strsize = 50;2 struct bop //结构体就像一个数据类型如int 使用前应该先给他一个变量如本题中的bop3 {4 char fullname[strsize]; // real name5 char title[strsize]; // job title6 char bopname[strsize]; // secret BOP name7 int preference; // 0 = fullname, 1 = title, 2 = bopname8 };9 void display_by_name(const struct bop *bopArray, unsign...
编程练习答案
习题1 习题2 习题3 习题4 习题5
习题1//winec.h
#ifndef WINEC_H_
#define WINEC_H_
#include <iostream>
#include <string>
#include <valarray>
using namespace std;
template<class T1, class T2>
class Pair
{
private:T1 year;T2 bottles;
public:Pair(const T1 &yr, const T2 &bt) :year(yr), bottles(bt) {}Pair() {}void Set(const T1 &yr, const T2 &bt);int Sum()const;void Show(int y)con...