a_5_8.cpp

来自「C++应用教程原码,里面包含该书中有十三章内容的代码,详细具体」· C++ 代码 · 共 24 行

CPP
24
字号
#include "stdafx.h"
#include <iostream>
using namespace std;

void area(double x)  
{  cout << "The area of circle_1 is " << 3.14*x*x<<endl;
}
void area(int x) 
{  cout << "The area of circle_2 is " << 3.14*x*x<<endl;
}
void area(double x,double y) 
{  cout << "The area of trigon is " << 0.5*x*y<<endl;
}
void main()
{              
  double radius=54.32,length=6.28,high=5.22;                                                				
  char cval ='m';
  area(radius);           //	①
  area(cval);             //    ②
  area(length, high);     //    ③
  cin.get(); //等待结束,以便调测程序,可以删除
}

⌨️ 快捷键说明

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