编写我的第一个程序,我的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;
}