1

9、10、13行目のエラー「タイプ'std:istream'の左側のオペランドをとる演算子が見つかりません(または受け入れ可能な変換がありません'」

#include <stdafx.h>  // I should have put #include "stdafx.h" instead
#include <iostream>  // My mistake was I didn't #include <string>

using namespace std;
    int main()
{
    cout << "This is the left step bitwise operation\n";
    string x;
    cin >> x;  // line 9
    cout << "You typed" << x;  //line 10
    string y;
    cout << "Enter second number please!"; 
    cin >> y; // line 13
    cin.get();
    return 0;
} // line 

私の漠然とした推測は、私が何かを#includeしなかったということです

4

3 に答える 3

3

あなたはするのを忘れました#include <string>。コードは、文字列を入力するとき、文字列を宣言するとき、および出力するときに、これに依存します。

#include "stdafx.h"
#include <iostream>
#include <string> <------

私はこれについてあまり信用できないので、それはコミュニティウィキです。

于 2012-12-19T01:24:10.537 に答える
0
#include "stdafx.h"  
or move 
#include <stdafx.h>
add 
#include <string>
于 2012-12-19T02:21:16.957 に答える
0

同じディレクトリのファイルを含める場合は、角引用符を使用せず、代わりにdoubledを使用してください。

#include "stdafx.h"

また、を含めます<string>

于 2012-12-19T01:25:06.393 に答える