#include <iostream>
using namespace std;
void YorN();
void CorF();
int main()
{
return 0;
}
void YorN()
{
char answer;
cout << "请问可以格式化你的硬盘吗" << "Y/N" << "\n";
cin >> answer;
switch (answer)
{
case 'Y':
case 'y':
cout << "格式化掉就没的用了"<<endl;
break;
case 'N':
case 'n':
cout << "还好你没点错"<<endl;
break;
default:
cout << "听不懂你说的啥" << endl;
break;
}
cout << "请输入任何字符来结束程序" << "\n";
cin.ignore(100, '\n');
cin.get();
}
void CorF()
{
const unsigned short ADD = 32;
const double RATIO = 9.0 / 5.0;
double TempIn, TempOut;
char typeIN, typeOUT;
cout << "请以xx.c或xx.f的格式输入一个温度" << endl;
cin >> TempIn >> typeIN;
cin.ignore(100, '\n');
cout << endl;
switch (typeIN)
{
case 'C':
case 'c':
TempOut = TempIn * RATIO + ADD;
typeOUT = 'F';
typeIN = 'C';
break;
case 'F':
case 'f':
TempOut = (TempIn - ADD) / RATIO;
typeOUT = 'C';
typeIN = 'F';
break;
default:
typeOUT = 'E';
cout << "输入格式有误"<<endl;
break;
}
if (typeOUT != 'E')
{
cout <<"输入温度信息为" << TempIn << typeIN<<"转换后的温度信息为"<<TempOut<<typeOUT<<endl;
}
else
{
cout <<"输入信息有误 检查一下"<<endl;
}
}
