[問題] C++的問題
#include <stdio.h>
#include <stdlib.h>
#include <string.h.>
class car
{
public:
int wheel;
int person;
char name[];
};
int main()
{
car truck, bus, taxi;
bus.wheel=6;
bus.person=40;
strcpy(bus.name, "公車");
truck.wheel=8;
truck.person=3;
strcpy(truck.name, "卡車");
taxi.wheel=4;
taxi.person=5;
strcpy(taxi.name, "計程車");
printf("%s有%d個輪子,可載%d人\n", bus.name, bus.wheel, bus.person);
printf("%s有%d個輪子,可載%d人\n", truck.name, truck.wheel, truck.person);
printf("%s有%d個輪子,可載%d人\n", taxi.name, taxi.wheel, taxi.person);
system("pause");
}
有2075488429個輪子,可載44712人
卡車有8個輪子,可載3人
計程車有4個輪子,可載5人
請按任意鍵繼續 . . .
有2075488429個輪子,可載44712人
卡車有8個輪子,可載3人
計程車有4個輪子,可載5人
請按任意鍵繼續 . . .
以上是執行結果:
紅色那行有問題
而且我按任意鍵想結束
結果不會結束 反而再跑出一個執行結果
要按cmd視窗的x才能關掉視窗 orz
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.169.161.198
→
02/11 12:11, , 1F
02/11 12:11, 1F
→
02/11 12:15, , 2F
02/11 12:15, 2F
推
02/11 12:19, , 3F
02/11 12:19, 3F
→
02/11 12:19, , 4F
02/11 12:19, 4F
→
02/11 12:22, , 5F
02/11 12:22, 5F
→
02/11 12:23, , 6F
02/11 12:23, 6F
→
02/11 12:23, , 7F
02/11 12:23, 7F
※ 編輯: Ygulu 來自: 118.169.161.198 (02/11 12:24)
→
02/11 12:25, , 8F
02/11 12:25, 8F
推
02/11 13:20, , 9F
02/11 13:20, 9F
→
02/11 13:21, , 10F
02/11 13:21, 10F
→
02/11 13:22, , 11F
02/11 13:22, 11F
→
02/11 13:23, , 12F
02/11 13:23, 12F
→
02/11 13:41, , 13F
02/11 13:41, 13F
→
02/11 13:41, , 14F
02/11 13:41, 14F
→
02/11 13:42, , 15F
02/11 13:42, 15F
→
02/11 13:43, , 16F
02/11 13:43, 16F
→
02/11 14:09, , 17F
02/11 14:09, 17F
→
02/11 14:10, , 18F
02/11 14:10, 18F
推
02/12 18:53, , 19F
02/12 18:53, 19F
討論串 (同標題文章)
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章