![]() |
#2
U2010100092016-07-14 10:02
|

#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;
void mutual(char* val)
{
unsigned int x;
char l_s;
double a_s,c_s;
x=unsigned int strlen(const char* val);
l_s=*(val+x-1);
a_s=double atof(*(val+x-2));
if(l_s=='C'||l_s=='c')cout<<"Degrees Fahrenheit"<<a_s*9/5+32<<"F"<<endl;
else if(l_s=='F'||l_s=='f')cout<<"Degrees Celsius"<<5/9*(a_s-32)<<"C"<<endl;
else cout<<"Please enter the correct temperature."<<endl;
}
int main()
{
char value;
cout<<"Please enter the fahrenheit or celsius.Remember plus unit."<<endl;
cin.get(value);
mutual(&value);
return 0;
}
#include<cstdlib>
#include<cstring>
using namespace std;
void mutual(char* val)
{
unsigned int x;
char l_s;
double a_s,c_s;
x=unsigned int strlen(const char* val);
l_s=*(val+x-1);
a_s=double atof(*(val+x-2));
if(l_s=='C'||l_s=='c')cout<<"Degrees Fahrenheit"<<a_s*9/5+32<<"F"<<endl;
else if(l_s=='F'||l_s=='f')cout<<"Degrees Celsius"<<5/9*(a_s-32)<<"C"<<endl;
else cout<<"Please enter the correct temperature."<<endl;
}
int main()
{
char value;
cout<<"Please enter the fahrenheit or celsius.Remember plus unit."<<endl;
cin.get(value);
mutual(&value);
return 0;
}
--------------------Configuration: text3 - Win32 Debug--------------------
Compiling...
text3.cpp
F:\VC Class\3rd\text3.cpp(10) : error C2062: type 'unsigned int' unexpected
F:\VC Class\3rd\text3.cpp(12) : error C2062: type 'double' unexpected
Error executing cl.exe.
text3.exe - 2 error(s), 0 warning(s)
[此贴子已经被作者于2016-7-14 09:35编辑过]