- 博客(52)
- 收藏
- 关注
原创 7.6
#include #include using namespace std; typedef struct student {int num; char name[20]; double score; }; int main() { student stud[3]={1234,"jiang",78,1123,"Wang",89.5,1234,"hu",90}, dst
2015-06-15 23:29:47 284
原创 7.3
#include #include using namespace std; int main() { for(int n=1;n<8;n++) cout<<setw(20-n)<<setfill(' ')<<" " <<setw(2*n-1)<<setfill('B')<<"B"<<endl; return 0; }
2015-06-15 23:10:41 257
原创 7.5
#include #include using namespace std; struct staff {int num; char name[20]; int age; double pay; }; int main() { staff staf[7]={2001,"Li",34,1200,2002,"Wang",23,2222,2003,"Fun
2015-06-09 17:31:55 280
原创 7.2
#include #include using namespace std; int main() {float a[5]; cout<<"input data:"; for(int i=0;i<5;i++) cin>>a[i]; cout<<setiosflags(ios::fixed)<<setprecision(2); for(int i=0;i<
2015-06-09 17:21:10 275
原创 7.1
#include #include using namespace std;int main() {double a,b,c,s,area; cout<<"please input a,b,c:"; cin>>a>>b>>c; if (a+b<=c) cerr<<"a+b<=c,error!"<<endl; else if(b+c<=a) cerr<<"
2015-06-09 17:16:09 245
原创 异质链表保存学生信息
#include#includeusing namespace std;class Student{public: virtual void get()=0; virtual void display()=0; string name; int num;};class UGraduate :public Student//本科生{public: void get()
2015-05-26 23:18:01 407
原创 6.5
#include using namespace std; class Shape {public: virtual double area() const =0; }; class Circle:public Shape {public: Circle(double r):radius(r){} virtual double area() cons
2015-05-24 11:06:16 218
原创 6.4
#include using namespace std; class Shape {public: virtual double area() const =0; }; class Circle:public Shape {public: Circle(double r):radius(r){} virtual double area() const {r
2015-05-24 11:00:23 223
原创 6.3
#include using namespace std;class Point{ public: Point(float a,float b):x(a),y(b){} ~Point(){cout<<"executing Point destructor"<<endl;} private: float x; float y; }; class Circl
2015-05-24 10:54:14 215
原创 10.3修改
//扩展程序:创建一个三角形类//修改create_object函数,使得程序支持三角形的创建//和求面积、打印等操作#include using namespace std;class Shape {public: virtual double getArea() const = 0; virtual void print() const = 0; virtual ~Shap
2015-05-19 22:12:56 276
原创 5.10
#include #include using namespace std; class Teacher {public: Teacher(int,char [],char); void display(); private: int num; char name[20]; char se
2015-05-18 07:35:26 234
原创 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 name; int age;
2015-05-18 07:26:12 265
原创 5.4
#include using namespace std; class Student {public: //基类公用成员 void get_value(); void display( ); protected : //基类保护成员 int num; char name[10]; char sex; };
2015-05-17 22:58:56 238
原创 5.3
#include using namespace std;class Student{public: void get_value(); void display( ); protected : int num; char name[10]; char sex; }; void Student::get_value() {ci
2015-05-17 22:47:09 307
原创 5.2
#include using namespace std; class Student {public: void get_value() {cin>>num>>name>>sex;} void display( ) { cout<<"num: "<<num<<endl; cout<<"name: "<<name<<endl; cout<<"sex: "
2015-05-17 22:37:20 298
原创 5.1
#include using namespace std; class Student {public: void get_value(){cin>>num>>name>>sex;} void display( ) { cout<<"num: "<<num<<endl; cout<<"name: "<<name<<endl; cout<<"se
2015-05-17 22:31:06 250
原创 1
#include using namespace std; class Student {public: void get_value() {cin>>num>>name>>sex;} void display( ) {cout<<"num: "<<num<<endl; cout<<"name: "<<name<<endl; cout<<"
2015-05-11 22:53:07 276
原创 7
#include #include using namespace std; class Student {public: Student(int,char[],char,float); int get_num(){return num;} char * get_name(){return name;} char get_sex(){return sex;}
2015-05-11 22:49:04 276
原创 6
#include using namespace std; class Complex {public: Complex(){real=0;imag=0;} Complex(double r){real=r;imag=0;} Complex(double r,double i) {real=r;imag=i;}
2015-05-11 22:35:35 307
原创 5
#include using namespace std; class Matrix {public: Matrix(); friend Matrix operator+(Matrix &,Matrix &); friend ostream& operator<<(ostream&,Matrix&); friend istream& opera
2015-05-11 22:30:42 265
原创 综合
#include #include using namespace std; class Time { public: void display(){cout<<hour<<":"<<minute<<":"<<sec<<endl;} protected: int hour; int minute; int sec; };
2015-05-11 22:20:50 222
原创 4.cpp
#include using namespace std; class Matrix { public: Matrix(); friend Matrix operator+(Matrix &,Matrix &); void input();
2015-05-11 22:15:20 259
原创 3.cpp
#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 opera
2015-04-28 20:33:17 270
原创 2.cpp
#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);Comple
2015-04-28 20:06:26 349
原创 1.cpp
#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_ima
2015-04-28 19:29:08 308
原创 11.cpp
#include using namespace std; class Time; class Date {public: Date(int,int,int); friend Time; private: int month; int day; int year; }; Date::Date(int m,int d,int y):month(m),day(d),year
2015-04-19 22:52:06 207
原创 10.cpp
#include using namespace std; class Date; class Time {public: Time(int,int,int); friend void display(const Date &,const Time &); private: int hour; int minute; int sec; };Time::Time(int
2015-04-19 22:46:55 219
原创 2.cpp
#include using namespace std; class Date {public: Date(int,int,int); Date(int,int); Date(int); Date(); void display(); private: int month; int day; int year; }; Date::Date(int m,int d
2015-04-19 22:43:32 472
原创 9.cpp
#include using namespace std; class Product{ public: Product(int n,int q,float p):num(n),quantity(q),price(p){}; void total(); static float average(); static void disp
2015-04-19 17:07:09 223
原创 8.cpp
#include using namespace std; class Student { public: Student(int n,float s):num(n),score(s){} void change (int n,float s) {num=n;score=s; } void display() {cout<<num<<""<<score<<endl; };
2015-04-19 11:25:46 264
原创 7.cpp
#include using namespace std; class Student { public: Student(int n,float s):num(n),score(s){} void change (int n,float s) {num=n;score=s; } void display() {cout<<num<<""<<score<<endl; };
2015-04-19 11:19:36 209
原创 6.cpp
#include using namespace std; class Student { public: Student(int n,float s):num(n),score(s){} void change (int n,float s){num=n;score=s; } void display(){cout<<num<<""<<score<<endl; }; pr
2015-04-19 11:13:35 223
原创 3.cpp
#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(m)
2015-04-19 10:49:32 310
原创 5.cpp
#include using namespace std; class Student {public: Student(int n,float s):num(n),score(s){} int num; float score; }; void main() { Student stud[5]={ Student(3901,
2015-04-07 20:52:11 240
原创 4.cpp
#include using namespace std; class Student { public: Student(int n,float s):num(n),score(s){} void display(); private: int num; float score; };void Student::display() { cou
2015-04-07 20:39:51 200
原创 第二章—5
//xt2-5-1.cpp(file1.cpp) #include #include "xt2-5.h" int main() {Array_max arrmax; arrmax.set_value(); arrmax.max_value(); arrmax.show_value(); return 0; } //xt2-5-2.cpp(arraym
2015-04-07 18:06:37 314
原创 第二章 — 4
//xt2-4-1.cpp(main.cpp)#include using namespace std; #include "student.h" int main() {Student stud; stud.set_value(); stud.display(); return 0; } //xt2-4-2.cpp(student.cpp)
2015-04-07 18:00:29 284
原创 2.1改写
#include using namespace std; class Time { private: int hour; int minute; int sec; public: void set_time(); void display(); }; void Time::set_time() { cin>>hour; cin>>min
2015-03-28 14:28:40 517
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人