3-7

#include<iostream>
using namespace std;
int chu(unsigned short int a,unsigned short int b)
{
if(b!=0)
{int c=a/b;
return c;
}
else
{
return -1;
}
}
int main()
{
int a=chu(6,0);
cout<<a;
system("pause");
return 0;
}

3-8

#include<iostream>
using namespace std;
int tem(int F)
{
float C=(F-32)*5/9;
return C;
}
int main()
{
int F=0;
float C=tem(F);
cout<<"华氏温度为:";
cin>>F;
cout<<"摄氏温度为"<<C;
system("pause");
return 0;
}

3-9

 

posted on 2023-04-17 20:55    阅读(10)  评论(0编辑  收藏  举报