2013-10-14 73 views
0

我正在學習C++,下面的示例trows「`輸入'未聲明(首次使用此函數)」。 我一直在閱讀本網站的一些問題,它似乎與不聲明函數有關。但我無法讓它工作。任何幫助將不勝感激。錯誤:cout C++ undeclared

// 
// Program to convert temperature from Celsius degree 
// units into Fahrenheit degree units: 
// Fahrenheit = Celsius * (212 - 32)/100 + 32 
// 
#include <cstdio> 
#include <cstdlib> 
#include <iostream> 


using namespace std; 
int main(int nNumberofArgs, char* pszArgs[]) 
{ 
// enter the temperature in Celsius 
int celsius; 
cout << 「Enter the temperature in Celsius:」; 
cin >> celsius; 
// calculate conversion factor for Celsius 
// to Fahrenheit 
int factor; 
factor = 212 - 32; 
// use conversion factor to convert Celsius 
// into Fahrenheit values 
int fahrenheit; 
fahrenheit = factor * celsius/100 + 32; 
// output the results (followed by a NewLine) 
cout << 「Fahrenheit value is:」; 
cout << fahrenheit << endl; 
// wait until user is ready before terminating program 
// to allow the user to see the program results 
system(「PAUSE」); 
return 0; 
} 
+5

你是在Microsoft Word上輸入的嗎? – 0x499602D2

+0

不,在DEV C++ IDE中,實際上我沒有輸入它。我從C++ For Dummy第5版中複製了這個例子。 – sms

回答

2

變化

cout << 「Enter the temperature in Celsius:」; 

cout << "Enter the temperature in Celsius:"; 

「」""是不同的。

+0

謝謝,它工作。 – sms

+0

@sms:不客氣:) – LihO

3

請使用簡單的文本編輯器或IDE。你的報價不正確。

cout << 「Enter the temperature in Celsius:」; 

應改爲

cout << "Enter the temperature in Celsius:"; 

錯誤被拋出,因爲引號應該像"

+0

感謝您的提示,我正在使用dev C++ IDE。 – sms