- 博客(57)
- 收藏
- 关注
原创 第六周实验报告1
#include using namespace std; class C { private: int x; public: C(int x){this->x = x;} int getX() {return x;} }; void main() { C c(5); cout<<c.getX(); system("pause"); }
2012-03-26 18:03:33 432 1
原创 第五周实验报告4
#include using namespace std; class Student { private: int num; int score; public: void show(); int getnum(){return num;} int getscore(){return score;} Student(int a,int b):num(a),score(b){
2012-03-20 14:39:57 355 1
翻译 第五周实验报告2
#include using namespace std; class CFraction { private: int nu; // 分子 int de; // 分母 public: void input(); //按照"nu/de"的格式,如"5/2"的形式输入 void Simplify(); //化简(使分子分母没有公因子) v
2012-03-19 19:26:54 282
原创 第五周实验报告3
#include using namespace std; class Box { private: int length; int width; int heigth; public: Box(int length=4 ,int width=4 ,int heigth=4); int barea(); int volune(); void get(
2012-03-19 19:12:25 280
原创 第五周实验报告1.3
#include #include using namespace std; class Triangle { public: Triangle(float a=1 ,float b=1, float c=1 ); float perimeter(void);//计算三角形的周长 float area(void);//计算并返回三角形的面积 voi
2012-03-19 18:35:22 309
原创 第五周实验报告1.2
#include #include using namespace std; class Triangle { public: Triangle(float ,float, float); float perimeter(void);//计算三角形的周长 float area(void);//计算并返回三角形的面积 void showMessage();
2012-03-19 18:06:15 283
原创 第五周实验报告1
任务1】设计三角形类,通过增加构造函数,使对象在定义时能够进行初始化 #include #include using namespace std; class Triangle { public: Triangle(); Triangle(float x,float y,float z):a(x),b(y),c(z){} float perimeter(void);//
2012-03-17 17:26:33 311
原创 第四周实验报告4
#include using namespace std; class Salary { private: double salary[50]; int number; public: void get_salary(); void add_salary(); void p_salary( ); void show_salary( ); }; i
2012-03-16 17:25:27 339
原创 第四周实验报告3
#include using namespace std; class NaturalNumber { private: int n; public: void setValue (int x);//置数据成员n 的值,要求判断是否是正整数 int getValue(); //返回私有数据成员n 的值 bool isPrime(); //判断数据成员n 是否为素数,是返回true
2012-03-13 14:15:01 666 1
原创 第四周实验报告1
#include #include #include using namespace std; class Triangle {public: void Setabc(float x, float y, float z);//置三边的值,注意要能成三角形 void Getabc(float *x, float *y, float *z);//取三边的值 float Perimete
2012-03-12 19:12:03 471 1
原创 第四周实验报告2
头文件:using namespace std; class Time {public: void set_time( ); void show_time( ); void add_n_sec(int ); void add_n_minute(int ); void add_n_hour(int ); void add_a_sec( );
2012-03-12 19:01:08 433 1
原创 第二周实验报告2
#include using namespace std; //定义长方体类 class Cub { public: void set_lwh(); void count_va(); void display(); private: double length; double width; double heigth; double volume;
2012-03-12 18:19:45 943
翻译 第二周实验报告2
#include using namespace std; class Time {public: void set_time( ); void show_time( ); void add_n_sec(int ); void add_n_minute(int ); void add_n_hour(int ); void add_a
2012-03-12 18:17:13 916
原创 第二周实验报告1
#include using namespace std; class Time { public: void set_time(void) ; void show_time(void); private: int hour; int minute; int sec; }; Time t; int main() { t.set_time(); t.show_tim
2012-03-12 18:14:36 1020
原创 第一周实验报告3-1
(3‐1)输入一行字符,统计其中有多少个单词。每两个单词之间以空格(可能多个)隔 开,或者由标点符号(只考虑 , . ; ? !共 5 种)隔开。 如输入: How old are your? I am 输出:There are 7 words in the line. 【知识点:字符数组】 算法说明: .#include #inclu
2012-03-04 21:18:59 267
原创 第一周实验报告
阶乘: #include using namespace std; long fac(int n) { long b; if(n==0) b=1; else b=n*fac(n-1); return b; } int main() { int m,n; long N; cout<<"请输入m,n的值:"; cin>>m>>n; N=(fac
2012-03-04 20:52:06 274
原创 第一周实验报告1
十进制转换二进制: #include using namespace std; void d2b(int n) { if(n==0) { cout<<" "; } else { d2b(n/2); cout<<n%2; } } int main() { int a; cout<<"请输入十进制数:";
2012-03-04 20:45:40 255
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人