错误:cout c ++未声明

时间:2013-10-14 17:50:41

标签: c++ cout

我正在学习c ++,下面的例子是“输入”未声明(首先使用此功能)“。 我一直在阅读本网站的一些问题,似乎与未声明功能有关。但我无法让它发挥作用。任何帮助将不胜感激。

//
// 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;
}

2 个答案:

答案 0 :(得分:3)

请使用简单的文本编辑器或IDE。你的报价不正确。

cout << “Enter the temperature in Celsius:”;

应改为

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

引发错误,因为引号应该与"而不是

相同

答案 1 :(得分:2)

更改

cout << “Enter the temperature in Celsius:”;

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

“”""不同。