Compare commits
10 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
b5a61ec98c | 6 years ago |
|
|
2348717c64 | 6 years ago |
|
|
0a0ee27002 | 6 years ago |
|
|
2809219b1f | 6 years ago |
|
|
2f20fb6414 | 6 years ago |
|
|
be550eda6a | 6 years ago |
|
|
3a8f2b01f5 | 6 years ago |
|
|
1ad97b69bf | 6 years ago |
|
|
b148911ee1 | 6 years ago |
|
|
63080c7513 | 6 years ago |
@ -0,0 +1,37 @@
|
|||||||
|
#ifndef CIRCLE_H
|
||||||
|
#define CIRCLE_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#define PI 3.14
|
||||||
|
|
||||||
|
class Circle
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
double r;//半径
|
||||||
|
public:
|
||||||
|
Circle();//构造函数
|
||||||
|
Circle(double R);//构造函数
|
||||||
|
double Area();//求面积函数
|
||||||
|
};
|
||||||
|
|
||||||
|
Circle::Circle()
|
||||||
|
{
|
||||||
|
this->r=5.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Circle::Circle(double R)
|
||||||
|
{
|
||||||
|
this->r=R;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Circle::Area()
|
||||||
|
{
|
||||||
|
return PI*r*r;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <chrono>
|
||||||
|
#include <random>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
void atlasPrint() {
|
||||||
|
std::default_random_engine generator(static_cast<int>(std::chrono::steady_clock::now().time_since_epoch().count()));
|
||||||
|
std::uniform_int_distribution<int> distribution(INT_MIN, INT_MAX);
|
||||||
|
std::cout << "Generate a random integer: " << distribution(generator) << std::endl;
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include "atlas.h"
|
||||||
|
#include "worka.h"
|
||||||
|
#include "workb.h"
|
||||||
|
#include "Circle.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
atlasPrint();
|
||||||
|
MyClass().Print();
|
||||||
|
test().Print();
|
||||||
|
cout << Circle().Area() << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in new issue