পোস্টগুলি

আগস্ট, ২০২০ থেকে পোস্টগুলি দেখানো হচ্ছে

Sort Class object

ছবি
 Code: #include<iostream> #include<algorithm> using namespace std; class Candidates{     string name;     int age;     double cgpa; public:     Candidates(){     }     Candidates(string name,int age,double cgpa){         this->name = name;         this->age = age;         this->cgpa = cgpa;     }     void print(){         cout<<"Name : "<<name<<'\t';         cout<<"Age : "<<age<<'\t'<<"CGPA : "<<cgpa<<endl;     }     bool operator<(const Candidates ca)const{         if(cgpa>ca.cgpa){//increasing order CGPA             return true;         }else if(cgpa==ca.cgpa){             if(age<ca.age){//decreasing or...

1022 TDA Rational(Play with oop)

URI 1022 TDA Rational : It is so easy problem. so after see solution try your self. It can be solve various way.But i am use OOP for practicing OOP.And i am use some extra thing. If you solve the problem.But it is not accepted than use uDebug to find out the BUG. Here is the problem  uDebug Link . C++ code:   #include<iostream> #include<math.h> using namespace std; int GCD(int num1,int num2){     if(num1%num2==0){         return num2;     }else{         return GCD(num2,num1%num2);     } } class rational{ private:     int numerator{0};     int denominator{0}; public:     void setData(int numerator,int denominator){         this->numerator = numerator;         this->denominator = denominator;     }friend ostream& operator<<(ostream& out,rational &ob);     rational operator+(rational ro)...

UVA 10286(Geometry)Trouble with a Pentagon

ছবি
UVA 10286(Geometry): Solution: C++ Code: #include<iostream> #include<math.h> #include<cstdio> #define pi acos(-1) #define constf (cos(pi/20)+(sin(pi/20)*tan(3*pi/20))) using namespace std; int main(){     double P;     while(cin>>P){         printf("%.10lf\n",P*constf);     }return 0; }