- 博客(35)
- 收藏
- 关注
原创 第7章第6题
#include #include using namespace std; struct student {int num; char name[20]; double score; }; int main() { student stud[3]={1001,"Li",78,1002,"Wang",89.5,1004,"Fun",90},stud1[3];
2015-06-09 13:03:18
465
原创 第7章第5题
#include #include using namespace std; struct staff {int num; char name[20]; int age; double pay; }; int main() {staff staf[7]={3898,"Fan",34,1200,3899,"Wang",23,6740,2448,"Chen",54,77
2015-06-09 12:55:17
434
原创 第7章第4题
#include #include using namespace std; void fun1() {int a[10]; ofstream outfile1("f1.dat"),outfile2("f2.dat"); if(!outfile1) {cerr ex
2015-06-08 22:34:18
327
原创 第7章第3题
#include #include using namespace std; int main() { for(int n=1;n cout return 0; }
2015-06-08 22:03:26
308
原创 第7章第2题
#include #include using namespace std; int main() { float a[5]; cout int i=0; for( i=0;i cin>>a[i]; cout for(i=0;i cout return 0; }
2015-06-08 21:58:25
318
原创 第7章第1题
#include #include using namespace std; int main() { float a,b,c,s,area; cout cin>>a>>b>>c; if (a+b cerr else if(b+c cerr else if (c+a cerr else { s=(a+b+c)/2;
2015-06-08 21:46:43
305
原创 学生信息
#include "iostream" #include "string" #include "list" using namespace std; class Student { protected: string Name; string Num; string Major; public: Student(){} Student(strin
2015-06-01 23:44:06
327
原创 第六章第6题
#include using namespace std; class Shape {public: virtual double area() const =0; }; class Circle:public Shape {public: Circle(double r):radius(r){}
2015-06-01 23:43:54
326
原创 创建三角类
#include #include "cmath" using namespace std; class Shape { public: virtual double getArea() const =0; virtual void print() const =0; virtual ~Shape(){} }; class Circle : publ
2015-06-01 22:22:12
360
原创 第5章第10题
#include #include using namespace std; class Teacher {public: Teacher(int,char [],char); void display();
2015-05-18 14:31:01
302
原创 第5章第9题
#include #include using namespace std; class Teacher {public: Teacher(string nam,int a,char s,string tit,string ad,string t); void display(); protected: string na
2015-05-18 14:23:43
250
原创 第5章第4题
#include using namespace std; class Student {public: void get_value(); void display( ); protected : int num; char name[10]; char sex; };
2015-05-18 14:19:27
268
原创 datetime
#include "iostream" using std::cin; using std::cout; using std::endl; using std::istream; using std::ostream; class Time { protected: int hour; int minute
2015-05-18 14:12:39
272
原创 第5章第3题
#include using namespace std; class Student {public: void get_value(); void display( ); protected :
2015-05-18 13:40:59
253
原创 第5章第2题
#include using namespace std; class Student {public: void get_value() {cin>>num>>name>>sex;} void display( ) {cout cout cout private : int num;
2015-05-18 13:29:04
513
原创 第5章第1题
#include using namespace std; class Student {public: void get_value() {cin>>num>>name>>sex;} void display( ) {cout cout cout private : int num;
2015-05-18 13:21:21
302
原创 第四章第7题
#include #include #include using namespace std; class Teacher; class Student {private: int num; string name; string sex; string position; public: Student(){}; Student(int n,string a,strin
2015-04-27 22:36:58
370
原创 第四章第6题
#include using namespace std; class Complex { public: Complex(){real = 0; imag = 0;} Complex(double r, double i){real =r; imag = i;} Complex operator+(double);
2015-04-27 22:30:59
327
原创 第四章第5题
#include using namespace std; class Matrix {public: Matrix(); friend Matrix operator+(Matrix &,Matrix &); friend ostream& operator friend istream& operator
2015-04-27 22:18:46
345
原创 第四章第4题
#include using namespace std; class Matrix //定义Matrix类 {public: Matrix(); //默认构造函数 friend Matrix operator
2015-04-27 22:02:52
303
原创 第四章第3题
#include using namespace std; class Complex { public: Complex(double r=0,double i=0):real(r),imag(i) { }; friend Complex operator +(Complex &c1,Complex &c2); friend Complex operator
2015-04-27 21:49:46
452
原创 第四章第2题
#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); Complex operator-(Complex &c2); Comple
2015-04-27 21:46:30
283
原创 第四章第1题
#include using namespace std; class Complex {public: Complex(){real=0;imag=0;} Complex(double r,double i){real=r;imag=i;} double get_real(); double get_imag();
2015-04-27 21:40:59
303
原创 字符串string
#ifndef _STRING_ #define _STRING_ #include "iostream" using std::ostream; using std::istream; class String { private: char *s; public: String(); String(int n
2015-04-27 21:21:45
236
原创 c++第12题
#include using namespace std; template class Compare { public: Compare(numtype a,numtype b):x(a),y(b){} numtype max(); numtype min(); private: numtype x; numtype y; }; template numt
2015-04-22 14:23:04
342
原创 c++第11题
#include using namespace std; class Date; class Time { public: Time(int,int,int); void display(Date&); private: int hour; int minute; int sec; }; class Date { public: Date(int,
2015-04-22 14:22:53
291
原创 c++第10题
#include using namespace std; class Date; class Time { public: Time(int,int,int); friend void display(Date&,Time&); private: int hour; int minute; int sec; }; class Date { public: Dat
2015-04-22 14:21:11
392
原创 c++第9题
#include #include #include using namespace std; class Transaction { public: Transaction(int n=0,double p=0,intq=0,double d=1):num(n),price(p),quantity(q),discount(d){} static double averag
2015-04-22 14:19:05
532
原创 c++第8题
#include using namespace std; class Student { public: Student(int n,float s):num(n),score(s){}//构造函数 void change(int n,floats){num=n;score=s;}//类赋值 voiddisplay(){cout private: intnum
2015-04-22 14:15:25
464
原创 c++第7题
#include using namespace std; class Student { public: Student(int n,float s):num(n),score(s){}//构造函数 void change(int n,float s) const {num=n;score=s;}//类赋值 void display() const {cout priv
2015-04-22 14:12:00
979
原创 c++第5题
#include #include using namespace std; class Student { private: int num;//学号 double score;//分数 public: friend istream& operator>>(istream& input,Student& s); friend ostream& operator frien
2015-04-22 14:10:07
385
原创 c++第4题
#include #include using namespace std; class Student { public: int num;//学号 double score;//学分 }; istream& operator >>(istream&input,Student& s) { cout input>>s.num; cout input>>s.score;
2015-04-22 14:06:39
714
原创 c++第三章第三题
#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, inty):month(m),day(d),y
2015-04-22 13:55:52
283
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅