簡體   English   中英

Cin和Cout不起作用

[英]Cin and Cout not working

#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的編譯器都說它們是一個未聲明的標識符。 我已經在這里和其他論壇上查看了所有答案,但沒有一種解決方案可以解決此問題。 提前致謝。

希望您有要包含在正確路徑中的“ stdafx.h”文件。 該代碼可以正常工作,而無需包含文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM