gpt4 book ai didi

c++ - 错误 : cout c++ undeclared

转载 作者:太空宇宙 更新时间:2023-11-04 16:19:02 25 4
gpt4 key购买 nike

我正在学习 C++,下面的例子显示“`Enter' undeclared (first use this function)”。我一直在阅读这个网站上的一些问题,它似乎与不声明功能有关。但我无法让它工作。任何帮助将不胜感激。

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

最佳答案

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

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

应该改为

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

错误被抛出是因为引号应该是 " 而不是

关于c++ - 错误 : cout c++ undeclared,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19366099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com