#include <iostream>
#include <windows.h> //Sleep函数调用的头文件
#include <mmsystem.h> //媒体控制函数的头文件
//在VC2008和VC6.0环境中从此头文件 #pragma comment(lib, "winmm.lib")
using namespace std;
class automobile
{
private:
char type[20];
char color[20];
float price;
int carry_weight;
int carry_customer;
public:
void set_date(char *t, char *c, float pri, int cw, int cc); //初始化或修改数据成员
void movecar(int l, int k);
void horming(int num);
void downcar(int l);
void play_mp3(char *ps);
char *show_type()
{
return type;
}
};
void automobile::set_date(char *t, char *c, float pri, int cw, int cc)
{
strcpy(type, t);
strcpy(color, c);
price = pri;
carry_weight = cw;
carry_customer = cc;
}
void automobile::movecar(int l, int k)
{
cout<<"\n"<<type<<"水平直线运动:"<<endl;
for(int i=0; i<l; i++)
{
cout<<' '<<"o-o";
C++汽车类实例
最新推荐文章于 2023-12-19 14:16:28 发布
![](https://img-home.csdnimg.cn/images/20240611030827.png)