DOS界面改变

1.change the DOS title windows+r->cmd->title [what you want] 2.change the DOS prefix windows+r->cmd->prompt [what you want] 3.change the DOS background's color windows+r->cmd->color [bf] (PS:b is representing background's color,you can input the code of...
DOS学习 | 2014-04-27 14:41 | 阅读 1263 次 | 评论 0 条

类和对象综合训练

#include <iostream> using namespace std; class CPoint { public: int x1; int y1; void output(); CPoint();//构造 CPoint(int x2,int y2);//重载 ~CPoint();//析构 private: int x2;; int y2; int *pCount; }; void CPoint::output() { if(pCount) (*pCount)++; else { pCount=new ...
c++ | 2014-04-27 14:09 | 阅读 1314 次 | 评论 0 条

构造函数重载

#include <iostream> using namespace std; class point { private: double fx,fy; public: point();//不带参 point(double fx,double fy);//带参 void showpoint(); }; point::point() { fx=0.0; fy=0.0; } point::point(double x,double y=5.0) { fx=x; fy=y; } void point::showpoint() { ...
c++ | 2014-04-27 09:21 | 阅读 1451 次 | 评论 0 条

定义类的成员函数的实现

#include <iostream> #include <string> using namespace std; class Cbook { private: char *m_pczName; int m_nPages; int m_nEdition; public: void GetBookName(char *pName); int GetTotalPages(); int GetBookEdition(); private: void SetBookName(char *pName); void SetTotalPages(int ...
c++ | 2014-04-26 11:15 | 阅读 1403 次 | 评论 0 条

字符串指针的应用

#include <iostream> #include <string> using namespace std; int main() { char str1[100]="hello"; char *str2="C++"; char *str; int i=0; cout<<"str2="<<str2<<endl; str=strcat(str1,str2); cout<<"strcat(str1,str2)="<<str<<endl; i=strcmp(str1,str2); cout<<"strcmp(str1,str2)="<<i<<...
c++ | 2014-04-19 23:42 | 阅读 1180 次 | 评论 0 条

数组倒序输出

#include <iostream> using namespace std; int main() { int a[5]; int i,j; cout<<"please input five data"<<endl; for(i=0;i<5;i++) cin>>a[i]; cout<<"convert data :"<<endl; for(j=4;j>=0;j--) cout<<a[j]<<"\t"; cout<<endl; return 0; }
c++ | 2014-04-18 22:45 | 阅读 1390 次 | 评论 0 条

圆周长面积计算

#include <iostream> const double PI=3.14; using namespace std; double fcir_l(double r) { double cir_l; cir_l=2*PI*r; return cir_l; } double fcir_s(double r) { double cir_s; cir_s=PI*r*r; return cir_s; } int main() { double radius, cir_l,cir_s; int i...
c++ | 2014-04-16 23:16 | 阅读 1349 次 | 评论 0 条
浏览36926次
最新评论