所以我昨天晚上開始學習C++,因爲它的東西我想進入一段時間,從我看過的幾個教程,它似乎可以是一個簡單的拿起考慮我很好與PHP和有經驗的是JAVA。「using namespace std;」不工作
一個問題,寫我的第一個程序,和我的「使用命名空間標準;」聲明不會工作,當我構建程序即時得到拋出這個錯誤:
C:\\Users\\p6735a\\Desktop\\Project\\game.cpp: In function `int main(int, char *)':
C:\\Users\\p6735a\\Desktop\\Project\\game.cpp:6: `string' undeclared (first use this function)
C:\\Users\\p6735a\\Desktop\\Project\\game.cpp:6: (Each undeclared identifier is reported only once
C:\\Users\\p6735a\\Desktop\\Project\\game.cpp:6: for each function it appears in.)
C:\\Users\\p6735a\\Desktop\\Project\\game.cpp:6: parse error before `;'
[Finished in 0.1s with exit code 1]
反正這裏是代碼:
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
string input;
int hp;
cout << "You see a man. Would you like to kill him?\n1. Yes\n2. No" << endl;
//cin >> input;
}
任何幫助表示讚賞!
哦,PS。如果有幫助,即時通訊使用的崇高文本2與GNU C++編譯器
您仍然需要包含必需的標題,例如'#包括' –
Joe
2013-04-30 01:08:37