This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center。
7年前关闭。
我做了一个函数“ 1”,我想问用户“你想重复一个函数“ 1”吗?”,我在做什么错?这是我的代码:
感谢帮助。
或类似。
7年前关闭。
我做了一个函数“ 1”,我想问用户“你想重复一个函数“ 1”吗?”,我在做什么错?这是我的代码:
#include <cstdlib>
#include <iostream>
using namespace std;
void temperature()
{
float c,f;
cout<<"Áveskite temperatørà pagal Celsijø: ";
cin>>c;
f=(c*1.8)+32;
cout<<"Temperatûra pagal Farenheità: ";
printf("%2.2f", f);
cout<<endl;
}
int main()
{
setlocale(LC_ALL,"Lithuanian");
temperature();
char isjungti;
cout<<"Paversti dar vienà temperatûrà?(T)";
cin>>isjungti;
if(isjungti == 'T' || 't')
{
return temperature(); //I get an error here.
}
system("PAUSE");
return EXIT_SUCCESS;
}
感谢帮助。
最佳答案
return
将退出功能范围。使用类似
while (isjungti == 'T' || isjungti == 't') {
temperature()
}
或类似。
关于c++ - 指定时功能不重复,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13335564/