Re: [問題] string所遇到的問題
#include <iostream>
#include <string>
using namespace std;
class Monster
{
public:
int lv;
int hp;
string name;
Monster(int theLv, int theHp, string theName)
{
lv = theLv;
hp = theHp;
name = theName;
}
};
void main()
{
Monster mon(10, 10, "TEST中文");
cout << mon.hp << endl;
cout << mon.lv << endl;
cout << mon.name << endl;
}
個人寫的你參考看看
我認為你的錯誤是因為,你沒有養成良好的打字習慣
所以造成誤判,建議先找找看
1.有沒有打錯字的地方
2.確認不是IDE在耍個性
上面我是用VC2008寫的
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.116.133.240
推
12/20 02:59, , 1F
12/20 02:59, 1F
推
12/20 03:02, , 2F
12/20 03:02, 2F
→
12/20 03:05, , 3F
12/20 03:05, 3F
→
12/20 03:09, , 4F
12/20 03:09, 4F
→
12/20 03:09, , 5F
12/20 03:09, 5F
→
12/20 03:11, , 6F
12/20 03:11, 6F
→
12/20 03:12, , 7F
12/20 03:12, 7F
→
12/20 03:13, , 8F
12/20 03:13, 8F
→
12/20 03:13, , 9F
12/20 03:13, 9F
→
12/20 03:13, , 10F
12/20 03:13, 10F
→
12/20 03:14, , 11F
12/20 03:14, 11F
→
12/20 03:16, , 12F
12/20 03:16, 12F
→
12/20 09:13, , 13F
12/20 09:13, 13F
→
12/20 14:21, , 14F
12/20 14:21, 14F
→
12/20 15:50, , 15F
12/20 15:50, 15F
→
12/20 15:51, , 16F
12/20 15:51, 16F
推
12/20 17:35, , 17F
12/20 17:35, 17F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):