#include <iostream>
#include <math.h>
#include "stdafx.h"
using namespace std;
int main()
{
float a, b;
cout << "Enter The Number: ";
cin >> a;
b = sqrt(a);
cout << "The Square Root of The Number Is: " << b;
return 0;
}
コンパイラはエラーを与える:このC++コードで何が問題になっていますか?
consoleapplication1.cpp(10): error C2065: 'cout': undeclared identifier
consoleapplication1.cpp(11): error C2065: 'cin': undeclared identifier
consoleapplication1.cpp(12): error C3861: 'sqrt': identifier not found
consoleapplication1.cpp(13): error C2065: 'cout': undeclared identifier
私にエラーを伝え、また、なぜ私は「stdafx.hを」を含まない、なぜそれが引用符であるしてください?? Visual Studio 2015を使用します。レベル:初心者
あなたは 'stdafx.h' [here](http://stackoverflow.com/questions/4726155/whats-the-use-for-stdafx-h-in-visual-studio)について読むことができます – Rakete1111
TL; DR : '#include" stdafx.h "'を動かすと、ソースファイルの最初の(コメントではない)行になります。 –
あなたが見せているエラーは唯一のものではないと確信しています。その前に、あらかじめコンパイルされたヘッダファイル '' stdafx.h ''が最初に含まれていないものがあるはずです。 –