#include <iostream>
#include<iomanip>
using namespace std;
class Point {
protected:
float x, y;
public:
Point(float a, float b) {
cout <<"Point constructor called" << endl;
x = a;
y = b;
}
~Point() {
cout << "Point destructor called" << endl;
}
};
class Circle :public Point {
private:
float r;
public:
Circle(float a, float b, float c) :Point(a, b) {
cout << "Circle constructor called" << endl;
r = c;
}
~Circle() {
cout << "Circle destructor called" << endl;
}
float getCircumference() {
return 3.14 * r * 2;
}
};
int main()
{
float x, y, r;
cin >> x >> y >> r;
Circle c(x, y, r);
cout << fixed << setprecision(2) << c.getCircumference() << endl;
return 0;
}
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
class Person{
protected:
string name;
int age;
public:
Person(){}
Person (string p_name, int p_age){
name=p_name;
age=p_age;
}
void display () {cout<<name<<":"<<age<<endl;}
};
class student:public Person{
private:
int ID;
float cpp_score;
float cpp_count;
float cpp_grade;
public:
student(){}
student(string str,int a,int b,float c,float d):Person(str,b){
ID=a;
cpp_score=c;
cpp_count=d;
cpp_grade=cpp_score * 0.9 + cpp_count * 2;
}
void print(){
cout<<ID<<" "<<name<<" "<<fixed<<setprecision(1)<<cpp_grade<<endl;
}
};
int main(){
while(1){
string str;
int a;//年龄
int b;//ID
float c;//cpp_score
float d;//cpp_count
cin>>str>>a>>b>>c>>d;
if(str=="0"){
break;
}
student s1(str,a,b,c,d);
s1.print();
}
return 0;
}