作業/小組任務 2019-1924194 作業: //在控制臺中錄入槍的信息(類型,攻擊力,彈夾容量,當前彈夾內子彈數,剩余子彈數) //*請輸入槍的類型....* //......... //*請錄入攻擊力:* //.......... //類型為:xxx,攻擊力是:xxx,彈夾容量是:xxx,當前彈夾內子彈數:xxx,子彈剩余數:xxx。
作業/小組任務?2019-1924194
作業:
//在控制臺中錄入槍的信息(類型,攻擊力,彈夾容量,當前彈夾內子彈數,剩余子彈數)
//*請輸入槍的類型....*
//.........
//*請錄入攻擊力:*
//..........
//類型為:xxx,攻擊力是:xxx,彈夾容量是:xxx,當前彈夾內子彈數:xxx,子彈剩余數:xxx。
求編碼?
2019-12-17
#include<iostream>
#include<string.h>
using namespace std;
class Gun
{
?? ?public:
?? ??? ?string type;
?? ??? ?int ATK;
?? ??? ?int GunCapacity;
?? ??? ?int NowCapacity;
?? ???? int?? ?Surplus;?? ? // or residue
};
int main(void)
{
?? ?Gun *p = new Gun();
?? ?cout << "請依次輸入槍的信息:類型,攻擊力,彈夾容量,當前彈夾內子彈數,剩余子彈數" << endl;
?? ?cin >> p->type >> p->ATK >> p->GunCapacity >> p->NowCapacity >> p->Surplus;
?? ?cout << p->type+" " << p->ATK << " " << p->GunCapacity << " " << p->NowCapacity << " " << p->Surplus;
?? ?delete p;
?? ?p=NULL;
?? ?return 0;
}
2019-10-02