- 博客(9)
- 收藏
- 关注
原创 第七章
第一题 #include #include"math.h" using namespace std; void Rec() { int a, b, c; float area , s ; cout << "输入三角形三条边:" << endl; cin >> a >> b >> c; s = (a + b + c) / 2; area = sqrt(s * (s-
2015-06-22 22:07:16 154
原创 第六章
Zhixin.cpp: #include #include"Cylinder.h" using namespace std; int main() { Cylinder cy1(3.5,6.4,5.2,10); cout << "original cylinder: \nx = " << cy1.getX() << ", y = " << cy1.getY() << ", r = "
2015-06-22 22:02:08 149
原创 第五章
第一题 #include using namespace std; class Student{ public: void get_value() {cin>>num>>name>>sex;} void display() { cout cout cout } private: int num; char name[10
2015-06-22 20:58:56 167
原创 创建一个三角形类
#include using namespace std; class Shape//虚基类(纯虚) { public: virtual double getArea() const = 0; //输出面积的函数 virtual void print() const = 0; //输出对象的函数,后面估计要运算符重载 virtual ~Shape(){} };
2015-06-22 20:52:59 745
原创 第四章运算符重载
#ifndef _STRING_ #define _STRING_ #include "iostream" using std::ostream; using std::istream; class String { private: char *s; public: String(); String(int n); String(const char *str); String
2015-06-22 20:45:02 191
原创 第四章
第一题 #include using namespace std; class Complex { public: Complex(){real = 0 ; imag = 0;} Complex(double r, double i){real = r ; imag = i;} Complex operator+ (Complex &c2); void display();
2015-06-22 20:06:39 143
原创 第三章
第三小题 #include using namespace std; class Date { public: Date(int=1,int=1,int=2005); void display(); private: int month; int day; int year; }; Date::Date(int m,int d,int y):month(
2015-04-20 21:38:24 132
原创 第二章
第二题 #include using namespace std; class Time { private: int hour; int minute; int sec; public: void shuru() { cin >> hour ; cin >> minute; cin >> s
2015-04-07 13:11:51 164
原创 第一章
第七题 #include using namespace std; int main() { int max (int x =10, int y =30); max(); cout << " max = " << max() << endl; return 0; } int max ( int x, int y) { if (x>y)
2015-04-07 12:54:50 131
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人