#include<iostream>
int main()
{
std::cout<<"Enter two number:"<<std::endl;
int v1,v2;
std::cin>>v1>>v2;
int lower,upper;
if(v1<=v2)
{
lower=v1;
upper=v2;
}
else
{
lower=v2;
upper=v1;
}
std::cout<<"Values of "<<lower<<"to "<<upper<<"inclusive are:"<<std::endl;
...
#include <iostream>
#include <string>
using namespace std;
class Date
{
int mo,da,yr;
char *month;
public:
Date(int m=0,int d=0,int y=0);
~Date();
Date& operator=(const Date&);
void display() const;
};
Date::Date(int m,int d,int y)
{
static char *mos[]=
{
"Janua...
#include<iostream>
using namespace std;
class CPoint
{
public:
CPoint(int x=0,int y=0);
int SetTemp();
void Print();
void Print() const;
private:
int m_x;
const int m_y;
static const int m_z;
int m_temp;
};
void main()
{
const int ARRAY_SIZE=5;
CPoint *pCPoint;
pCPoi...
#include <iostream>
#include <string>
using namespace std;
class Internet
{
public:
Internet(char *name,char *url)
{
Internet::name=new char[strlen(name)+1];
Internet::url=new char[strlen(url)+1];
if(name)
{
strcpy(Internet::name,name);
}
if(url)
{
strcpy(Int...
class Shape
{
public:
Shape() {}
~Shape() {}
virtual float GetArea()=0;
virtual float GetPerim()=0;
};
class Circle:public Shape
{
public:
Circle(float radius):itsRadius(radius) {}
float GetArea()
{
return 3.14*itsRadius*itsRadius;
}
float GetPerim()
{
return ...
#include <iostream>
using namespace std;
typedef char string80 [80];
class Data
{
public:
Data() {}
Data(int y, int m, int d)
{
SetData(y,m,d);
}
void SetData(int y,int m,int d)
{
Year=y;
Month=m;
Day=d;
}
string80 &GetStringData(string80 &Data)
{
spr...
#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 ...
#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()
{
...
#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 ...
#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<<...
#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;
}
#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...