這是Herr Deng桑的教學blog,主要處理作業與班導事務,另外還有數位小品。
person X[30]; mt19937 gen(clock()); // Mersenne Twister algorithm is based on the // Mersenne prime 219937−1 normal_distribution dis0(163, 7); normal_distribution dis1(55, 5); ……
#include #include #include using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<
#include <iostream>#include <random>#include <ctime>using namespace std;class person{double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<<i<<":\t"; cout<<"height="<<height<<"\t"; cout<<"weight="<<weight<<"\t"; cout<<"bmi="<<bmi()<<endl; } };int main(){ person X[30]; mt19937_64 gen(clock()); normal_distribution<double> dis0(163,7); normal_distribution<double> dis1(55,5); for(int i=0;i<30;i++){ double h=dis0(gen); double w=dis1(gen); X[i]=person(h,w); X[i].print(i); } return 0;}
#include <iostream>#include <algorithm>#include <random>#include <fstream>#include <cstdlib>#include <ctime>using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height;}void print(int i){cout<<"第"<<i<<"位同學的BMI:"<<bmi()<<"\t";cout<<"身高:"<<height<<"\t";cout<<"體重:"<<weight<<"\t"<<endl;}};int main(){ person X[30]; mt19937 gen(clock()); normal_distribution <double> A(160,7); normal_distribution <double> B(50,10); for (int i=1;i<31;i++){ double height=A(gen); double weight=B(gen); X[i]=person(height,weight); X[i].print(i); } return 0;}
#include <iostream>#include <random>#include <ctime>using namespace std;class person{public: double height, weight; int i; person(){} person(double height, double weight) { this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i) { cout<<i<<":\t"; cout<<"height="<<height<<"\t"; cout<<"weight="<<weight<<"\t"; cout<<"bmi="<<bmi()<<endl; }};int main(){ person X[30]; mt19937_64 gen(clock()); normal_distribution<double> dis0(163,7); normal_distribution<double> dis1(55,5); for (int i=0;i<30;i++){ double h=dis0(gen); double w=dis1(gen); X[i]=person(h,w); X[i].print(i); } return 0;}
#include <iostream>#include <random>#include <ctime>using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<<i<<":\t"; cout<<"height="<<height<<"\t"; cout<<"weight="<<weight<<"\t"; cout<<"bmi="<<bmi()<<endl; }};int main(){ person X[30]; mt19937 gen(clock()); normal_distribution<double> dis0(163, 7); normal_distribution<double> dis1(55, 5); for(int i=0; i<30; i++){ double h=dis0(gen); double w=dis1(gen); X[i]=person(h, w); X[i].print(i); } return 0;}
#include <iostream> #include <random>#include <ctime>using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<<i<<":\t"; cout<<"height="<<height<<"\t"; cout<<"weight="<<weight<<"\t"; cout<<"bmi="<<bmi()<<endl; }};int main(){ person X[30]; mt19937_64 gen(clock()); normal_distribution<double> dis0(163, 7); normal_distribution<double> dis1(55, 5); for (int i = 0; i < 30; i++) { double h=dis0(gen); double w=dis1(gen); X[i]=person(h,w); X[i].print(i);} return 0;}
#include <iostream>#include <algorithm>#include <random>#include <fstream>#include <cstdlib>#include <ctime>using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print (int i){ cout<<"第"<<i<<"位同學"<<":\t"; cout<<"身高="<<height<<"\t"; cout<<"體重="<<weight<<"\t"; cout<<"BMI="<<bmi()<<"\t"; if(bmi()<18.5) cout<<"體重過輕"<<endl; else if(bmi()<24) cout<<"正常範圍"<<endl; else if (bmi()>=24) cout<<"體重過重"<<endl; }};int main(){ person X[30]; mt19937 gen(clock()); normal_distribution<double> g1(163, 7); normal_distribution<double> g2(55, 5); for (int i = 1; i<31; i++) { double h = g1(gen); double w = g2(gen); X[i]=person(h,w); X[i].print(i); } return 0;}
#include #include #include using namespace std;class person{ double height, weight;public: person(){} person(double height,double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<<":\t"; cout<<"height="< dis0(163, 7); normal_distribution dis1(55, 5); for(int i=0; i<30; i++){ double h=dis0(gen); double w=dis1(gen); x[i]=person(h,w); x[i].print(i); } return 0;}
#include <iostream>#include <random>#include <ctime>using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<<i<<":\t"; cout<<"height="<<height<<"\t"; cout<<"weight="<<weight<<"\t"; cout<<"bmi="<<bmi()<<endl; }}; int main() { person x[30]; mt19937_64 gen(clock()); normal_distribution <double>dis0(163, 7); normal_distribution <double>dis1(55, 5); for(int i=0; i<30; i++){ double h=dis0(gen); double w=dis1(gen); x[i]=person(h,w); x[i].print(i); } return 0; }
#include <iostream>#include <random>#include <ctime>using namespace std;class person{ double height, weight; public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; } void print(int i){ cout<<i<<":\t"; cout<<"height="<<height<<":\t"; cout<<"weight="<<weight<<":\t"; cout<<"bmi="<<bmi()<<endl; }};int main() { person X[30]; mt19937_64 gen(clock()); normal_distribution<double> dis0(163, 7); normal_distribution<double> dis1(55, 5); for(int i=0; i<30; i++){ double h=dis0(gen); double w=dis1(gen); X[i]=person(h, w); X[i].print(i); } return 0;}
#include <iostream>#include<random>#include<ctime>using namespace std;class person{ double height ,weight;public : person(){} person (double height,double weight){ this->height=height; this->weight=weight; } double bmi() { return 10000*weight/height/height; } void print(int i){ cout<<i<<":\t"; cout<<"height="<<height<<"\t"; cout<<"bmi="<<bmi()<<endl; } }; int main(){person X[30];mt19937 gen(clock());normal_distribution<double> dis0(163, 7);normal_distribution <double>dis1(55, 5);for(int i=0;i<30;i++){ double h=dis0(gen); double w=dis1(gen); X[i]=person(h,w); X[i].print(i);}return 0;}
#include <iostream>#include <random>#include <ctime>using namespace std;class person{ double height, weight;public: person(){} person(double height, double weight){ this->height=height; this->weight=weight; } double bmi(){ return 10000*weight/height/height; }void print(int i){ cout<<i<<":\t"; cout<<"高="<<height<<":\t"; cout<<"體重="<<weight<<":\t"; cout<<"bmi="<<bmi()<<endl;}};int main(){person x[30];mt19937_64 gen(clock());normal_distribution<double>dis0(163,7);normal_distribution<double>dis1(55,5);for(int i=0; i<30;i++){ double h=dis0(gen); double w=dis1(gen); x[i]=person(h,w); x[i].print(i);}return 0;}
#include #include #include using namespace std;class person{double height, weight;public:person(){}person(double height, double weight){this->height=height;this->weight=weight;}double bmi(){return 10000*weight/height/height; }void print(int i){cout<<i<<":\t";cout<<"高="<<height<<":\t";cout<<"體重="<<weight<<":\t";cout<<"bmi="<<bmi()<<endl;}};int main(){person x[30];mt19937_64 gen(clock());normal_distribution<double>dis0(163,7);normal_distribution<double>dis1(55,5);for(int i=0; i<30;i++){double h=dis0(gen);double w=dis1(gen);x[i]=person(h,w);x[i].print(i);}return 0;}
#include #include #include using namespace std;class person{public:double height, weight;int i;person(){}person(double height, double weight){this->height=height;this->weight=weight; } double bmi(){return 10000*weight/height/height;} void print(int i){cout<<i<<":\t";cout<<"height="<<height<<"\t";cout<<"weight="<<weight<<"\t";cout<<"bmi="<<bmi()<<endl;}};int main(){person X[30];mt19937_64 gen(clock());normal_distribution<double> dis0(165,7);normal_distribution<double> dis1(55,5);for (int i=0;i<30;i++){double h=dis0(gen);double w=dis1(gen);X[i]=person(h,w);X[i].print(i);}return 0;}
#include #include #include using namespace std;class person{double height, weight;public:person(){}person(double height, double weight){this->height=height;this->weight=weight;}double bmi(){return 10000*weight/height/height;}void print(int i){cout<
張貼留言
17 則留言:
#include
#include
#include
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"weight="<<weight<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937_64 gen(clock());
normal_distribution<double> dis0(163,7);
normal_distribution<double> dis1(55,5);
for(int i=0;i<30;i++){
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h,w);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include <algorithm>
#include <random>
#include <fstream>
#include <cstdlib>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<"第"<<i<<"位同學的BMI:"<<bmi()<<"\t";
cout<<"身高:"<<height<<"\t";
cout<<"體重:"<<weight<<"\t"<<endl;
}
};
int main(){
person X[30];
mt19937 gen(clock());
normal_distribution <double> A(160,7);
normal_distribution <double> B(50,10);
for (int i=1;i<31;i++){
double height=A(gen);
double weight=B(gen);
X[i]=person(height,weight);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
public:
double height, weight;
int i;
person(){}
person(double height, double weight)
{
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i)
{
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"weight="<<weight<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937_64 gen(clock());
normal_distribution<double> dis0(163,7);
normal_distribution<double> dis1(55,5);
for (int i=0;i<30;i++){
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h,w);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"weight="<<weight<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937 gen(clock());
normal_distribution<double> dis0(163, 7);
normal_distribution<double> dis1(55, 5);
for(int i=0; i<30; i++){
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h, w);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"weight="<<weight<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937_64 gen(clock());
normal_distribution<double> dis0(163, 7);
normal_distribution<double> dis1(55, 5);
for (int i = 0; i < 30; i++) {
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h,w);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include <algorithm>
#include <random>
#include <fstream>
#include <cstdlib>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print (int i){
cout<<"第"<<i<<"位同學"<<":\t";
cout<<"身高="<<height<<"\t";
cout<<"體重="<<weight<<"\t";
cout<<"BMI="<<bmi()<<"\t";
if(bmi()<18.5)
cout<<"體重過輕"<<endl;
else if(bmi()<24)
cout<<"正常範圍"<<endl;
else if (bmi()>=24)
cout<<"體重過重"<<endl;
}
};
int main()
{
person X[30];
mt19937 gen(clock());
normal_distribution<double> g1(163, 7);
normal_distribution<double> g2(55, 5);
for (int i = 1; i<31; i++)
{
double h = g1(gen);
double w = g2(gen);
X[i]=person(h,w);
X[i].print(i);
}
return 0;
}
#include
#include
#include
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height,double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<":\t";
cout<<"height="< dis0(163, 7);
normal_distribution dis1(55, 5);
for(int i=0; i<30; i++){
double h=dis0(gen);
double w=dis1(gen);
x[i]=person(h,w);
x[i].print(i);
}
return 0;
}
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"weight="<<weight<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person x[30];
mt19937_64 gen(clock());
normal_distribution <double>dis0(163, 7);
normal_distribution <double>dis1(55, 5);
for(int i=0; i<30; i++){
double h=dis0(gen);
double w=dis1(gen);
x[i]=person(h,w);
x[i].print(i);
}
return 0;
}
#include
#include
#include
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height,double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<":\t";
cout<<"height="< dis0(163, 7);
normal_distribution dis1(55, 5);
for(int i=0; i<30; i++){
double h=dis0(gen);
double w=dis1(gen);
x[i]=person(h,w);
x[i].print(i);
}
return 0;
}
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"height="<<height<<":\t";
cout<<"weight="<<weight<<":\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937_64 gen(clock());
normal_distribution<double> dis0(163, 7);
normal_distribution<double> dis1(55, 5);
for(int i=0; i<30; i++){
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h, w);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include<random>
#include<ctime>
using namespace std;
class person{
double height ,weight;
public :
person(){}
person (double height,double weight){
this->height=height;
this->weight=weight;
}
double bmi()
{
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937 gen(clock());
normal_distribution<double> dis0(163, 7);
normal_distribution <double>dis1(55, 5);
for(int i=0;i<30;i++){
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h,w);
X[i].print(i);
}
return 0;
}
#include <iostream>
#include <random>
#include <ctime>
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"高="<<height<<":\t";
cout<<"體重="<<weight<<":\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{person x[30];
mt19937_64 gen(clock());
normal_distribution<double>dis0(163,7);
normal_distribution<double>dis1(55,5);
for(int i=0; i<30;i++){
double h=dis0(gen);
double w=dis1(gen);
x[i]=person(h,w);
x[i].print(i);
}
return 0;
}
#include
#include
#include
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<<i<<":\t";
cout<<"高="<<height<<":\t";
cout<<"體重="<<weight<<":\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{person x[30];
mt19937_64 gen(clock());
normal_distribution<double>dis0(163,7);
normal_distribution<double>dis1(55,5);
for(int i=0; i<30;i++){
double h=dis0(gen);
double w=dis1(gen);
x[i]=person(h,w);
x[i].print(i);
}
return 0;
}
#include
#include
#include
using namespace std;
class person{
public:
double height, weight;
int i;
person(){}
person(double height, double weight)
{
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i)
{
cout<<i<<":\t";
cout<<"height="<<height<<"\t";
cout<<"weight="<<weight<<"\t";
cout<<"bmi="<<bmi()<<endl;
}
};
int main()
{
person X[30];
mt19937_64 gen(clock());
normal_distribution<double> dis0(165,7);
normal_distribution<double> dis1(55,5);
for (int i=0;i<30;i++){
double h=dis0(gen);
double w=dis1(gen);
X[i]=person(h,w);
X[i].print(i);
}
return 0;
}
#include
#include
#include
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<
#include
#include
#include
using namespace std;
class person{
double height, weight;
public:
person(){}
person(double height, double weight){
this->height=height;
this->weight=weight;
}
double bmi(){
return 10000*weight/height/height;
}
void print(int i){
cout<
張貼留言