我正在学习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;
}
答案 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:";
“”
和""
不同。