摘要:
Linux下的在线播放神器:一个是Amarok缺点是,每个音乐源都要更新后才能播放。 在一个就是中国造的:linux deepin下的深度音乐,缺点就是连不上。反正我是连不上 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 class Point 5 { 6 public: 7 Point(int x=0,int y=0):x(x),y(y){} 8 int getX() const {return x;} 9 int getY() const {return y;}10 private:11 int x,y;12 };13 int main()14 {15 Point a(4,5);16 Point * p1=&a;17 18 int (Point::*funcPtr)() c... 阅读全文
摘要:
//6-13#includeusing namespace std;class Point{public: Point(int x=0,int y=0):x(x),y(y){} int getX() const {return x;} int getY() const {return y;}private: int x,y;};int main(){ Point a(4,5); Point * p1=&a; int (Point::*funcPtr)() const=&Point::getX; cout*funcPtr)()getX() 2 //... 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 5 void printStuff(float data) 6 { 7 cout<<"this is the print stuff function."<<endl; 8 } 9 10 void printMessage(float data)11 {12 cout<<"the data to be listed is"<<data<<endl;13 }14 15 void printFloat(float data) 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 5 void splitFloat(float x,int * intPart,float * fracPart) 6 { 7 *intPart=static_cast(x); 8 *fracPart=x-*intPart; 9 }10 11 12 int main()13 {14 cout>x;20 splitFloat(x,&n,&f);21 cout<<"Inter Part="<<n<<"Fraction Part=&quo 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 5 6 int main() 7 { 8 int i; 9 int *ptr=&i;10 i=10;11 cout<<"i="<<i<<endl;12 cout<<"*ptr="<<*ptr<<endl;13 14 return 0;15 } 阅读全文
摘要:
//在weight.h中#ifndef _WEIGHT_H_#define _WEIGHT_H_class Car;class Boat{ private: double weight; public: Boat(double w=0.0):weight(w){} double getWeight(){return weight;} friend double getTotalWeight(Car & m,Boat & n);};class Car{ private: double weight; p... 阅读全文
摘要:
1 #include 2 3 int main() 4 { 5 int line1[]={1,0,0}; 6 int line2[]={1,0,0}; 7 int line3[]={1,0,0}; 8 9 int * pLine[3]={line1,line2,line3};10 11 std::cout<<"Matrix test:"<<std::endl;12 13 14 for(int i=0;i<3;++i)15 for(int j=0;j<3;j++)16 std::cout<<pLine[... 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 5 class A 6 { 7 public: 8 A(int i); 9 void print();10 private:11 const int a;12 static const int b=10;13 };14 15 16 A::A(int i):a(i){}17 18 void A::print()19 {20 cout<<a<<":"<<b<<endl;21 }22 //常成员函数只能通过初始化来获得初值23 24 int main()25 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 5 class A 6 { 7 private: 8 int x,y; 9 public:10 A(int i,int j):x(i),y(j){}11 void Adisplay() const12 {13 cout<<"x="<<x<<" "<<"y="<<y<<endl;14 }15 };16 17 int main()18 {19 const A a(5,4);20 a.Adisp 阅读全文
摘要:
1 #include 2 3 using namespace std; 4 5 class Point 6 { 7 public: 8 Point(int x=0,int y=0):x(x),y(y){} 9 int getX() const {return x;}10 int getY() const {return y;}11 private:12 int x,y;13 };14 int main()15 {16 Point a(4,5);17 Point *p1;p1=&a;18 cout<<(*p1).getX()<<end... 阅读全文
摘要:
//在weight.h中#ifndef _WEIGHT_H_#define _WEIGHT_H_class Point{public: Point(int x=0,int y=0):x(x),y(y){} int getX(){return x;} int getY(){return y;} friend float dist(Point &p1,Point &p2) { double x=p1.x-p2.x; double y=p1.y-p2.y; return static_cast(sqrt(x*x+y*y)); }private: ... 阅读全文
摘要:
1 #include 2 using namespace std; 3 class Point 4 { 5 public: 6 Point(int xx=0,int yy=0) 7 { 8 x=xx; 9 y=yy;10 cout<<"Constructor is called"<<endl;11 }12 Point(Point &p);13 int getX()14 {15 return x;16 }17 int getY()18 {19 ... 阅读全文
摘要:
#include using namespace std;class A{public: void display(){cout<<x<<endl;} int getX() {return x;} friend class B;private: int x;};class B{public: void set(int i); void display() { a.display(); };private: A a;};void B::set(int i){ a.x=i;}int main(){ cout << "H... 阅读全文