用C++。大佬可以解决吗

360U3211018117 |浏览1036次
收藏|2020/04/27 13:03

满意回答

2020/04/27 13:11

#include<iostream>using namespace std;class car{int money;string model , brand;public:void setcar(){money=100000;model="未设置";brand="未设置"};void setcar(int imoney,string imodel,string ibrand){money=imoney;model=imodel;brand=ibrand};void showcar(){cout<<"品牌:"<<brand<<"型号:"<<model<<"价格:"<<money;}}int main(){car car1,car2;car1.setcar();car2.setcar(150000,"凯越","别克");car1.showcar();cout<<endl;car2.showcar();return 0;}求采纳,谢谢!

好好好11111111

其他回答(0)
0人关注该问题
+1

 加载中...