Welcome   HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online
Home
FAQs
Problem Set
Practices
Online Contests
Major Exercises
OI Special
Judgement
Submit
Online Status
User Ranklist
Users
Register new
Login
Web Links
Hunan Normal University
College of Information Science and Engineering
多态性
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 235, Accepted users: 204
Problem 10504 : No special judgement
Problem description
  通过上机实践,完成下列程序,以验证抽象类、纯虚函数、多态性等概念:声明一个抽象类shape(虚形),并由它派生出两个类:Rectangle(实形正方形) Circle(实形园),它们都有求面积和求周长的函数。

Input
  输入数据第一行为一个整数T,表示有T组数据。每组数据一行,包含两个浮点数,分别表示实形正方形的边长和实形园的半径。

Output
  对于每一组数据,分别输出结果,小数点后保留三位精度。格式参照样例输出。pi取3.14。

Sample Input
2
100 100
5.5 8.4
Sample Output
Rectangle area is:10000.000
Rectangle perimeter is:400.000
Circle area is:31400.000
Circle perimeter is:628.000
Rectangle area is:30.250
Rectangle perimeter is:22.000
Circle area is:221.558
Circle perimeter is:52.752
Submit   Clarifications   Judge Status  Problems  Ranklist 

HUNAN NORMAL UNIVERSITY ACM/ICPC Judge Online, Version 2010.5.5.final.
Web visits:18902 today,16241893 total, since 2010-05-07