- 博客(22)
- 收藏
- 关注
原创 第六周实验报告 任务五
源程序://main.cpp#include#include "class.h"#includeusing namespace std;void main(){ CPoint p1, p2, p3; CTriangle tri(p1, p2, p3); double b1, b2, b3; while(1) { p1.input();
2012-03-28 22:54:52 361
原创 第六周实验报告 任务四
源程序:#include#includeusing namespace std;class CPoint{private: mutable double x; // 横坐标 mutable double y; // 纵坐标 public: CPoint(double xx=0,double yy=0); dou
2012-03-27 18:53:14 614 2
原创 第六周实验报告 任务三(改进)
源代码:#include#includeusing namespace std;enum SymmetricStyle { axisx,axisy,point};//分别表示按x轴, y轴, 原点对称class CPoint{private: mutable double x; // 横坐标 mutable double y; /
2012-03-27 18:26:57 393
翻译 第六周实验报告 任务三(自己做的···)
源代码:#include#includeusing namespace std;enum SymmetricStyle { axisx,axisy,point};//分别表示按x轴, y轴, 原点对称class CPoint{private: mutable double x; // 横坐标 mutable double y; /
2012-03-27 18:21:46 389
原创 第六周实验报告 任务二
源程序:#includeusing namespace std;class A {private: int a;public: A() {a=0;} A(int aa):a(aa){} //定义构造函数,用参数aa初始化数据成员a};void main() { A *p;//定义类A的指针对象p p = new A(6);
2012-03-27 18:15:04 577 1
原创 第六周实验报告 任务一
源程序:#includeusing namespace std;class C{public: int x; C(int x) { this -> x = x; } int getX() { return x; }};void main(){ C c(5); cout << c.ge
2012-03-24 20:12:07 394 1
原创 第五周实验报告 任务四
源程序:#includeusing namespace std;class Student{public: Student(int, float); void output_data(); int getnumber(); float getscore(); private: int number;
2012-03-24 20:02:17 373
原创 第五周实验报告 任务三
源程序:#includeusing namespace std;class Box{public: Box(int h = 10, int w = 10, int len = 10); int volume(); int perface(); void input(); private: int height;
2012-03-18 20:47:55 616 3
原创 第五周实验报告 任务二
源程序:#includeusing namespace std;class CFraction{private: int nume; // 分子 int deno; // 分母 public: CFraction(int nu=0
2012-03-18 12:13:10 606 1
原创 第五周实验报告 任务一
源代码://默认构造函数#include#includeusing namespace std;class Triangle{public: Triangle(float x = 1, float y = 1, float z = 1); // Triangle(float x, float y, float z); float
2012-03-17 15:43:49 357
原创 第四周实验报告 任务四
源代码:#includeusing namespace std;class Salary{public: void set_salary(); void show_salary(); void add_salary(int x); void sort_salary(); private: double salary[5
2012-03-16 19:50:01 400
原创 第四周实验报告 任务二
class Time{public: void set_time(); void show_time(); void add_second(int); void add_minute(int); void add_hours(int); void add_a_sec(); void add_a_minute(); void add_a_ho
2012-03-13 17:55:34 301 1
原创 第四周实验报告 任务三
源程序:#includeusing namespace std;class NaturalNumber{private: int n; public: void setValue (int x);//置数据成员n的值,要求判断是否是正整数 int getValue(); //返回私有数据成员n的值 bool isPrime(); //判断数据成员n是
2012-03-13 17:04:11 439 1
原创 第四周实验报告 任务一
源代码:#include#includeusing namespace std;class Triangle{public: void Setabc(float x, float y, float z);//置三边的值,注意要能成三角形 void Getabc(float *x, float *y, float *z);//取三边的值
2012-03-11 20:36:01 484 1
原创 第三周实验报告 任务三
源代码:#includeusing namespace std;class Time{public: void set_time(); void show_time(); void add_second(int); void add_minute(int); void add_hours(int); inline voi
2012-03-11 17:21:32 316
翻译 第三周实验报告 任务四
源代码:#includeusing namespace std;class Cub{public: void get_side(); void display();private: float length; float width; float height;};void Cub::get_side(){
2012-03-11 17:17:02 322
原创 第三周实验报告 任务二
源代码:#includeusing namespace std;class Time{public://必须说明类内部分的属性,否则系统会默认为私有的 void set_time(void); void show_time(void);private://一般情况下数据成员定义为私有,成员函数定义为共有 int hour; int minute; int
2012-03-11 10:20:35 305
原创 第二周实验报告 任务三(3-2)
源程序:#includeusing namespace std;int main(){ int i; char str[99]; cout<< "请输入一段话:"; gets(str); if(str[0] == ' ') { cout<<""; } for(i = 1; str[i] != '\0'; i
2012-03-04 13:37:13 349
原创 第二周实验报告 任务三(3-1)
源程序:#includeusing namespace std;int main(){ int i, num = 0; char str[99]; cout<< "请输入一段话:"; gets(str); for(i = 0; i < 99; i ++) { if(str[i] == ' ' || str[i] == ','||
2012-03-04 13:33:18 274
原创 第二周实验报告 任务二(2-1)
源程序:#includeusing namespace std;long fac(int n){ long f; if(n == 0 || n == 1) { f = 1; } else { f = fac(n - 1) * n; } return f;}int main ( ){ doub
2012-03-04 13:29:01 395
原创 第二周实验报告 任务一(1-2)
源程序:#includeusing namespace std;int main (){ int i = 0, j, n, a[50]; cout<< "请输入需要转换的数字:"; cin>> n; if(n < 0) { cout<< "error!!!"; } else if(n == 0) { cout<< n;
2012-03-04 13:22:32 298
原创 第二周实验报告 任务一(1-1)
源程序:#includeusing namespace std;void d2b(int n){ if(n == 0) { cout<< n; } else { d2b(n / 2); cout<< n % 2; }}int main(){ int a; cin>> a; d2b(a);
2012-03-04 13:16:05 258
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人