重载5.13.cpp

来自「本程序用C++实现华氏与摄氏温度的转换.函数运算.与系统时间显示」· C++ 代码 · 共 20 行

CPP
20
字号
#include <iostream.h>
#include <iomanip.h>
int square(int,int);
float square(float,float);
int main()
{ int a,b;
  float c,d;
  cout<<"输入整数"<<endl;
  cin>>a>>b;
  cout<<"输入浮点数"<<endl;
  cin>>c>>d;
  cout<<"The square of integer"<<a<<setw(3)<<b<<"is"<<square(a,b)<<endl;
  cout<<"The square of float"<<c<<setw(5)<<d<<"is"<<square(c,d)<<endl;
  return(0);
}
int square(int a,int b)
{  return (a*a+b*b); }
float square(float c,float d)
{  return (c*c+d*d); }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?