请问,我的vc程序错在哪了
来源:百度知道 编辑:UC知道 时间:2024/05/11 05:55:06
这是一个关于摄氏温度与华氏温度转化的问题(C代表摄氏温度,F代表华氏温度),我写了两个代码,第一个没报错但不能实现应有功能,第二个报错:
一、
#include <iostream>
using namespace std;
int main()
{float t,c,f;
char ch;
cout<<"Please input the temperature number: ";
cin>>t;
cout<<endl;
cout<<"Please choose the type of temperature,C or F?";
cin>>ch;
cout<<endl;
if (ch=='c'||'C')
{
f=(9.0/5.0)*t+32;
cout<<"The F temperature is "<<f<<"F."<<endl;
cout<<"Thank you."<<endl;
}
else if (ch=='f'||'F')
{
c=(5.0/9.0)*(t-32);
cout<<"The C temperature is "<<c<<"C."<<endl;
cout<<"Thank you."<<endl;
}
else cout<<"The type of temperature is wrong!"<<endl;
retu
一、
#include <iostream>
using namespace std;
int main()
{float t,c,f;
char ch;
cout<<"Please input the temperature number: ";
cin>>t;
cout<<endl;
cout<<"Please choose the type of temperature,C or F?";
cin>>ch;
cout<<endl;
if (ch=='c'||'C')
{
f=(9.0/5.0)*t+32;
cout<<"The F temperature is "<<f<<"F."<<endl;
cout<<"Thank you."<<endl;
}
else if (ch=='f'||'F')
{
c=(5.0/9.0)*(t-32);
cout<<"The C temperature is "<<c<<"C."<<endl;
cout<<"Thank you."<<endl;
}
else cout<<"The type of temperature is wrong!"<<endl;
retu
第一个是你的IF语句有问题,改成如下IF(CH=='C' | CH=='c'),类似这样。
第二个代码是你用的case语句有问题。
去掉所有的break
另外,判断大小写的语法最好是用uppercase
请问,我的vc程序错在哪了
书本的程序是不是错了我怎么调不出来那在VC++6.0
我装的vc在运行程序后总是出现Compiling...,请问这是为什么,拜托各位了
以下程序哪错了( vc++6.0)
用VC++编的程序中,使用了Access97格式的MDB,请问如何让这个程序在没有安装有VC的系统上能正常运行?
请问哪位大侠知道VC程序怎么在没安装VC的机器上运行?
请问:如何使用vc++ 来运行我的c程序?
为什么我用VC++编写的程序在没有装VC的机器上都不能用呢???
哪位高手帮我看看我这VC打开WORD程序哪错了啊~
为什么我在VC.net环境下写的程序,在别的没有安装VC或VC.NET环境的机器上,刚运行又退出了,我用的是静态