2011年11月15日
摘要: #include <iostream>using namespace std;int main(){int a=21;cout.setf(ios::showbase);cout<<"dec:"<<a<<endl;cout.unsetf(ios::dec);cout.setf(ios::hex);cout<<"hex:"<<a<<endl;cout.unsetf(ios::hex);cout.setf(ios::oct);cout<<"oct:&quo 阅读全文
posted @ 2011-11-15 18:42 Gavin Dai 阅读(227) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;class Time{public: Time(){minute=0;sec=0;} Time(int m,int s):minute(m),sec(s){} Time operator++(); Time operator++(int); void display(){cout<<minute<<":"<<sec<<endl;} private: int minute; int sec;};Time Time::operator++() 阅读全文
posted @ 2011-11-15 16:57 Gavin Dai 阅读(355) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <string>using namespace std;class String{public: String(){p=NULL;} String(char *str); friend bool operator>(String &string1,String &string2); friend bool operator<(String &string1,String &string2); friend bool operator==(String &strin 阅读全文
posted @ 2011-11-15 16:32 Gavin Dai 阅读(262) 评论(0) 推荐(0) 编辑
  2011年11月14日
摘要: #include <iostream>using namespace std;class Point{public:Point(float=0,float=0);void setPoint(float,float);float getX() const {return x;}float getY() const {return y;}friend ostream & operator<<(ostream &,const Point &);protected:float x,y;};Point::Point(float a,float b){x=a 阅读全文
posted @ 2011-11-14 19:46 Gavin Dai 阅读(2076) 评论(0) 推荐(0) 编辑
  2011年11月13日
摘要: #include <iostream>#include <string>using namespace std;int main(){ void max_string(char str[][30],int i);int i;char country_name[3][30];for(i=0;i<3;i++)cin>>country_name[i];max_string(country_name,3);return 0;}void max_string(char str[][30],int n){int i;char string[30];strcpy(s 阅读全文
posted @ 2011-11-13 22:37 Gavin Dai 阅读(181) 评论(0) 推荐(0) 编辑
摘要: #include <cmath>#include <iostream>using namespace std;float f(float x){return x * x * x - 5 * x *x + 16 * x - 80;}void main(void){float x1, x2, x0, f0, f1, f2;do {cout<<"Input x1, x2\n";cin>>x1>>x2;f1 = f(x1);f2 = f(x2);} while (f1 * f2 > 0);do {x0 = ( x1 阅读全文
posted @ 2011-11-13 22:01 Gavin Dai 阅读(253) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;class Date;class Time{public:Time(int,int,int);void display(const Date&);private:int hour;int minute;int sec;};class Date{public:Date(int,int,int);friend void Time::display(const Date &);private:int month;int day;int year;};Time::Time(int h,int m, 阅读全文
posted @ 2011-11-13 21:36 Gavin Dai 阅读(3409) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;class Time{public:Time(int,int,int);int hour;int minute;int sec;void get_time();};Time::Time(int h,int m,int s){hour=h;minute=m;sec=s;}void Time::get_time(){cout<<hour<<":"<<minute<<":"<<sec<<endl;}i 阅读全文
posted @ 2011-11-13 20:27 Gavin Dai 阅读(269) 评论(0) 推荐(0) 编辑
摘要: 函数分声明和定义,但是如果声明和定义是在一些起的,相当于没有声明的话,默认参数与inline就只要写在定义中就可以了。但是如果函数如果先声明后定义的话,默认参数只能写在声明中,定义时不能再写上默认参数。inline在声明中写,定义时可写可不写. 阅读全文
posted @ 2011-11-13 15:10 Gavin Dai 阅读(282) 评论(0) 推荐(0) 编辑
  2011年11月3日
摘要: /**************************************************************************** file name : LinkList.h* created : 2011/11/03* description : * author : Gavin Dai XLX* update :****************************************************************************/#ifndef __LINKLIST_H#define __LINKLIST_H#include &l 阅读全文
posted @ 2011-11-03 20:16 Gavin Dai 阅读(364) 评论(0) 推荐(0) 编辑