我寫了一個基本的程序,類似於ELIZA(在線治療師)簡單的問題和答案,但我堅持到底。後cin >>回答;我不能寫任何東西。如果有人能幫助它,將不勝感激!也與我一起,即時通訊編程新手。C++無法在cin後輸入>>回答;
int main() {
short number;
string color;
string sport;
int answer;
string travel;
// Greets user
cout << "Hello, I'm Samantha" << endl;
// Asks user for their favorite sport
cout << "What's your favorite sport?";
cin >> sport;
cout << "I like " << sport << " too!" << endl;
cout << "How about your favorite color?";
cin >> color;
cout << "Not my favorite color but it's nice!" << endl;
cout << "Tell me something you've never told anyone before";
cin >> answer;
cout << "Don't worry, your secret is safe with me!" << endl;
cout << "Hows your life going?";
cin >> answer;
return 0;
}
你的程序在'cin >>回答'後結束......你期待它做什麼? –
你在調試程序時看到了什麼?如果您還沒有嘗試過,請這麼做 – Fureeish
您的意思是_「以前從未告訴過任何人的事情」_是數字嗎? – Chad