#include <iostream>
#include "stdafx.h"
#include <string>
using namespace std;
int main()
{
//Variables in which student info is stored
string name = "";
//asks user for their name
cout << "/nHello, my name is Hal, what is your name? ";
cin >> name;
cout << "/nWelcome to C++ ";
cout << name;
cout << ", let the adventure begin!";
return 0;
}
実際には動作しないような基本的なコードです。コンパイラは、宣言されていない識別子だと言っています。私はここや他のフォーラムですべての答えを見てきましたが、解決策のどれもそれを修正するようには見えません。前もって感謝します。CinとCoutは動作しません。
どのようにコンパイルしていますか? – matt
ビジュアルスタジオ2015 –
C++を使用していますか?このプログラムはg ++でうまくコンパイルされます。もちろん、sans 'include stdafx.h'もあります。 – matt