Parameterized and Default Constructors In C++ | C++ Tutorials for Beginners #30

Поділитися
Вставка
  • Опубліковано 18 жов 2024
  • Download the best IDE for C, C# and C++: bit.ly/WholeTo...
    ►Source Code & Resources: codewithharry....
    ►This video is a part of my C++ playlist: • C++ Tutorials In Hindi
    ►For Doubt Solving, Brain Storming Sessions & guaranteed replies, join the channel membership here: / @codewithharry
    ►Click here to subscribe - / @codewithharry
    ►Checkout my English channel here: / programmingwithharry
    Best Hindi Videos For Learning Programming:
    ►Learn Python In One Video - • Python Tutorial In Hin...
    ►Python Complete Course In Hindi - • Python Tutorials For A...
    ►C Language Complete Course In Hindi -
    • C Language Tutorials I...
    ►JavaScript Complete Course In Hindi -
    • JavaScript Tutorials I...
    ►Learn JavaScript in One Video - • JavaScript Tutorial
    ►Learn PHP In One Video - • Learn Php In One Video...
    ►Django Complete Course In Hindi -
    • Python Django Tutorial...
    ►Machine Learning Using Python - • Machine Learning Tutor...
    ►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
    ►Advanced Python Tutorials - • Intermediate/Advanced ...
    ►Object Oriented Programming In Python - • Object Oriented Progra...
    ►Python Data Science and Big Data Tutorials - • Python Data Science an...
    Follow Me On Social Media
    ►Website (created using Flask) - www.codewithhar...
    ►Facebook - / codewithharry
    ►Instagram - / codewithharry
    ►Personal Facebook A/c - / geekyharis
    Twitter - / haris_is_here

КОМЕНТАРІ • 1,1 тис.

  • @SajjadHussain-b6p
    @SajjadHussain-b6p Рік тому +10

    you are the best teacher sir!
    //code for parametric constructor to find distance between x-coordinate and y-coordinate :
    #include
    #include
    #include
    using namespace std;
    class Point
    {
    int x, y;
    friend void distance(Point, Point);
    public:
    Point(int a, int b)
    {
    x = a;
    y = b;
    }
    void display_point()
    {
    cout

  • @samarththaker5051
    @samarththaker5051 Рік тому +2

    Distance between 2 points:
    void distance(point p, point q){
    int r = abs(p.x-q.x);
    int s = abs(p.y-q.y);
    float m = sqrt(r*r+s*s);
    cout

  • @vaishnavihud1666
    @vaishnavihud1666 Рік тому +143

    //create a function which takes two point objects and computes the distance between those two points
    //Hint :make it a friend function
    #include
    #include
    using namespace std;
    class point{
    int x ,y ;
    friend void distance(point o1 ,point o2 );
    public:
    point (int a ,int b){
    x=a;
    y=b;
    }
    void display(){
    cout

    • @tmkocfan5135
      @tmkocfan5135 11 місяців тому +5

      correct one

    • @GOJOANDSUKUNAFAN
      @GOJOANDSUKUNAFAN 7 місяців тому

      Same code Dalal ni chla nalle

    • @Ashutosh-r5v
      @Ashutosh-r5v 5 місяців тому

      thanks

    • @kranti9473
      @kranti9473 5 місяців тому +1

      Thank you for the help...
      It really helped a lot..
      May god bless you 🙏

    • @swamisds
      @swamisds 4 місяці тому

      if we want that user should tell us the points, what would be the code changes in int main then ?

  • @prateekdhingra292
    @prateekdhingra292 3 роки тому +12

    Harry Bhai ekdum mast samajh aa gaya! saare concepts ki complete practice ho gayi.

  • @RahulSaini-pp5kz
    @RahulSaini-pp5kz 2 роки тому +99

    I did the distance between two poitns all by myself after encountering some errors and i am very happy about it.Thank you very much😭😭😭😭😭😭😭😭😭😭😭😭😭😭

    • @पापीगुडिया-ह3ढ
      @पापीगुडिया-ह3ढ 2 роки тому +12

      Rota kahe ko h ye le chocolate kha

    • @ak689
      @ak689 2 роки тому +12

      @@पापीगुडिया-ह3ढ papi gudiya bhag ja bache ko rulati hai😡
      Rahul bro isse chocolate 🍫 nhi lena

    • @पापीगुडिया-ह3ढ
      @पापीगुडिया-ह3ढ 2 роки тому +9

      @@ak689 rahul ko to kabka chocolate 🍫 de diya ab teri baari h chote
      Haahaaahaahaaaa..............

    • @Suraj_2662
      @Suraj_2662 2 роки тому +1

      @@पापीगुडिया-ह3ढ om phatt swaha
      bhag ja yaha se👻

    • @TechBrgv
      @TechBrgv 2 роки тому

      @@पापीगुडिया-ह3ढ tere chocolate Dene se kuch nhi hoga bhag yaha se verna ham sab coder bhga bhaga ke mare ge

  • @trendy_takes
    @trendy_takes 2 роки тому +15

    Finally Harry Bhai ko "tempcoderunner" wale error ka reason smj aa gya 😅... Btw... He is the best in his field 🙌🏻❤️

  • @rajasarkar2397
    @rajasarkar2397 Рік тому +3

    First time i did something by myself. It takes little more time but I'm very happy. Thank you harry sir

  • @anju7334
    @anju7334 Рік тому +10

    I did it 🙏.
    Firstly I thought that I couldn't do this but I said to myself let's give it a try.
    And Maine kar liya with god's grace.
    Thanku so much sir for providing us immense knowledge for free.
    ❤️

  • @Justin_Roy
    @Justin_Roy 3 роки тому +8

    Main Logic
    Without Using Friend Function .......
    Public:
    Point(int,int,int,int);
    void Printdata()
    {
    cout

  • @Devendrakr63
    @Devendrakr63 3 роки тому +3

    Thanks

  • @bhaskarsaini4369
    @bhaskarsaini4369 2 роки тому +236

    // Parameterized Constructor using Friend Function Example :-
    #include
    #include
    using namespace std;
    class point{
    int x,y;
    friend void distance (point , point);
    public:
    point (int a,int b){
    x=a;
    y=b;
    }
    void displayPoint(){
    cout

    • @pranavmaniyar4592
      @pranavmaniyar4592 2 роки тому +18

      diff ko int kyu define kiya , double would have been better , isn't it?

    • @ankitjha.23
      @ankitjha.23 2 роки тому +3

      😘

    • @AKS-td5iz
      @AKS-td5iz 2 роки тому +5

      @@ankitjha.23 mwah mwah baby

    • @curiousritik4558
      @curiousritik4558 2 роки тому +5

      Bhai garbage value kyu aari

    • @mohammadayasha9499
      @mohammadayasha9499 2 роки тому +3

      if you write return type of "diff" variable as float then it will be better.

  • @sukhmanpreetsinghsandhub2042
    @sukhmanpreetsinghsandhub2042 3 роки тому +10

    great way of explanation i am enjoying them a lot thank you so much

  • @sushilasriv19
    @sushilasriv19 3 роки тому +63

    The smallest and the easiest way :-
    Function will be like this (Just make this function as a friend in the class) :-
    void distancePoint(Point obj1, Point obj2)
    {
    double dis;
    dis = sqrt(pow((obj2.x - obj1.x), 2) + pow((obj2.y - obj1.y), 2));
    cout

    • @DoLLarOnDick
      @DoLLarOnDick 2 роки тому +3

      Abe bhai constructor ka use to kiya ni tumne.... 😂
      Aise to sbko pta h aasan h

    • @vipinishere9679
      @vipinishere9679 2 роки тому

      Bhai point class kaha gyi tere program ki

    • @sumanshrestha8867
      @sumanshrestha8867 2 роки тому +1

      Bhai
      displaypoint()
      function kaha hai

  • @aryaman8414
    @aryaman8414 5 місяців тому

    I have used both method 1> just by declaring a function to calculate distance 2> using friend function
    #include
    using namespace std;
    class point{
    int x,y;
    public:
    point(int a,int b){
    x=a;
    y=b;
    }
    // ---> Normally
    // float dis(point p, point q){
    // int ans=pow(abs(p.x - q.x),2) +pow(abs(p.y- q.y),2) ;
    // return pow(ans,0.5);
    // }
    friend float dist(point ,point);
    };
    // using function as friend
    float dist(point p, point q){
    int ans=pow(abs(p.x - q.x),2) +pow(abs(p.y- q.y),2) ;
    return pow(ans,0.5);
    }
    int main(){
    point a(0,0);
    point b(4,3);
    //cout

  • @manavsingh3941
    @manavsingh3941 Рік тому +17

    Quiz1:
    Distance b/w 2 Points
    #include
    #include
    using namespace std;
    class point{
    int x, y;
    friend void distance(point, point);
    public:
    point(int a, int b){
    x = a;
    y = b;
    }
    void display(void){
    cout

  • @ayushmishra360
    @ayushmishra360 4 місяці тому +1

    This can be done without including cmath file, we can make use of babylonians method for sqrt

  • @mathlover7688
    @mathlover7688 3 роки тому +5

    Harry bhai sab tutorial mein ek ek single example add kar do n bahut bahut meharbaani hogi aise aap jitna diye wahi main repeat karke dekhunga ho jayega

  • @gwsunnyff6715
    @gwsunnyff6715 11 місяців тому

    first we want to include the heterofile(#include)
    double distanceTo(point otherPoint)
    {
    return sqrt(pow(otherPoint.x - x, 2) + pow(otherPoint.y - y, 2));
    }

  • @strein6502
    @strein6502 4 роки тому +7

    you are great bro, Thanks vai for this tutoring , It helps me very much

  • @motivationalTalks810
    @motivationalTalks810 Рік тому

    THANK YOU HARRY BHAIYA FOR MAKING THE CONCEPT EASY.
    CODE:
    #include
    #include
    using namespace std;
    double v;
    class point{
    int a,b;
    public:
    friend class dist;
    void setPoint(int x,int y){
    a=x;
    b=y;
    }
    int displayDistance(point,point);
    };
    class dist{
    public:
    int distance(point,point);
    };
    int dist :: distance(point a1,point a2){
    int diff1=(a1.a-a2.a)*(a1.a-a2.a);
    int diff2=(a1.b-a2.b)*(a1.b-a2.b);
    if (diff1>diff2){
    v=sqrt(diff1-diff2);
    }
    else{
    v=sqrt(diff2-diff1);
    }

    return v;
    }
    int point :: displayDistance(point a1,point a2){
    cout

  • @nishkarshjain5684
    @nishkarshjain5684 4 роки тому +9

    Thank u soo much bro...
    Ur videos really helps me... 🥰

  • @sarveshjd376
    @sarveshjd376 Рік тому

    Sir, I think I did it, bdi mehnat lgi but done. Thanks a lot abhi tk itni saari chizein is playlist ke through sikhaane ke liye.

  • @justfun-bn4kt
    @justfun-bn4kt 4 роки тому +3

    Aoa bro am pakistani aur ma na c++ learn krna tha aur ma ap ka sary lecture Dako ga aur ma na ap ko subscribe be kr Dia thks bro great effort. May you live long

  • @kumkumbhagya51
    @kumkumbhagya51 Рік тому

    14:25 maine bas aaj tk unhe graph pe banaya tha kabhi distance calculate nhi kri thi isliye ha doosro ke programs ko dekh ke seekh ke bana rha hu aur samjh aa rha hai ki unhone kaise use kiya formula

  • @AshutoshKumar-fu6qe
    @AshutoshKumar-fu6qe 3 роки тому +8

    This video has highest like to dislike ratio(=200) among the videos I have seen on UA-cam. Keep it up!

  • @LoneWolf2104
    @LoneWolf2104 Рік тому

    int main(){
    Complex c1, c2, sum;
    c1.setNumber(1, 4);
    c1.printNumber();
    c2.setNumber(5, 8);
    c2.printNumber();
    sum = sumComplex(c1, c2);
    sum.printNumber();
    return 0;
    }

  • @naman1312
    @naman1312 Рік тому +13

    Answer to the easy quiz.
    (For those who don't know these functions which I have used, read this then see the answer.)
    To do some basic math operations, we need to import header file .
    sqrt function --> It calculates the square root of a number.
    pow function --> It calculates the exponent of a number. It takes two parameters - the number to be powered and the power which has to be raised to that number.
    The code for the answer to this quiz:
    #include
    #include
    using namespace std;
    class Point{
    int x, y;
    friend float distance(Point, Point);
    public:
    Point(int a, int b){
    x = a;
    y = b;
    }
    void displayPoint(){
    cout

    • @YashYadvav123
      @YashYadvav123 Рік тому +1

      Thanks bro for providing this information😊... By the way you written this code by your own?

    • @naman1312
      @naman1312 Рік тому +1

      @@YashYadvav123 yes

    • @jee6455
      @jee6455 Рік тому

      Bro c++ ke notes bna rakhe h pdf file chaiye thi ?

    • @naman1312
      @naman1312 Рік тому

      @@jee6455 bhai maine itni mehnat se bnaye hai aise hi kaise dedu

    • @jee6455
      @jee6455 Рік тому

      @@naman1312 ohk

  • @EarthMarvels44
    @EarthMarvels44 2 роки тому +1

    int finddistance(point a, point b){
    int res = sqrt(pow((a.x-b.x),2)+pow((a.y-b.y),2));
    return res;
    }

  • @animeboii-zv8vo
    @animeboii-zv8vo 3 роки тому +10

    Thank you sir for this amazing and easy lecture

  • @cocshorts2620
    @cocshorts2620 5 місяців тому

    #include
    using namespace std;
    class sum{
    int a, b;
    public:
    sum(int x ,int y){
    //object name is goven while creating object
    a=x;
    b=y;
    cout

  • @anshumankumar1946
    @anshumankumar1946 2 роки тому +8

    Distance between two coordinate points:
    #include
    #include
    using namespace std;
    class Point
    {
    int x, y;
    friend int Distance(Point, Point);
    public:
    Point(int a, int b){
    x = a;
    y = b;
    }
    };
    int Distance(Point o1, Point o2){
    int x_diff = (o2.x-o1.x);
    int y_diff = (o2.y-o1.y);
    int diff = sqrt(pow(x_diff,2)+pow(y_diff,2));
    return diff;
    }
    int main(){
    Point p1(1, 1), p2(1,1);
    cout

    • @rahilpanwar5999
      @rahilpanwar5999 Рік тому

      int diff = sqrt(pow(x_diff,2)+pow(y_diff,2));i
      isme ,2 kyu use kara hai?

    • @anshumankumar1946
      @anshumankumar1946 Рік тому

      @@rahilpanwar5999 kyuki formula me square karte hai
      √((x2-x1)² + (y2-y1)²)
      To pow(xdiff,2) ka matlab wahi hai
      (x2-x1)²

  • @adityapradhan8474
    @adityapradhan8474 9 місяців тому

    Thank you so much harry bhai
    Because of you I am able to understand the concepts of OOPS so easily!

  • @aryan7069_
    @aryan7069_ 3 роки тому +5

    I made that function before you asked to . Also i took point in 3D space.
    float dist(Point p , Point q){
    return pow(pow(p.x - q.x , 2) + pow(p.y - q.y , 2) + pow(p.z - q.z, 2) , 0.5);
    }
    though i used pow lol

  • @kunalshahare9041
    @kunalshahare9041 3 роки тому +2

    thank you bhai

  • @nihalpandey5675
    @nihalpandey5675 4 роки тому +28

    // Program to calculate the distance between two cartesian points
    #include
    #include
    using namespace std;
    class point
    {
    int a,b;
    public :
    void setvalue (int x,int y)
    {
    a =x; b=y;
    }
    friend int distance (point A,point B);
    };
    int distance (point A,point B)
    {
    float c = sqrt ((A.a- B.a)*(A.a- B.a)+ (A.b- B.b)*(A.b- B.b));
    return c;
    }
    int main()
    {
    int x,y;
    cout > x>>y;
    point C,D;
    C.setvalue (x,y);
    cout > x>>y;
    D.setvalue (x,y);
    int c =distance (C,D);
    cout

  • @MensAttitude
    @MensAttitude 2 дні тому

    // Function to compute distance between two points
    float calculateDistance(Point p1, Point p2)
    {
    return sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));
    }

  • @093_kartikdwivedi3
    @093_kartikdwivedi3 2 роки тому +11

    program for getting the distance between two points:-
    //this is a program for getting the distance between two points using constructor and math function
    #include
    #include
    using namespace std;
    class point{
    int x , y;
    public:
    friend int distance(point o1,point o2);
    point(int , int );
    void display(){ // we can define the constructor here also
    cout

    • @ankitsoni6203
      @ankitsoni6203 7 місяців тому

      #include
      #include
      using namespace std;
      class point{
      int x,y;
      public:
      point(int a, int b){
      x=a;
      y=b;
      }
      void printpoint(){
      cout

  • @abrarahmad3897
    @abrarahmad3897 Рік тому +1

    Harry bhai, challenge or quiz accepted, here is my fully-functional code to print distance the two points wherein I have tried to utilise the concepts of parametrised constructor, friend function and even explored some new mathematical functions in the c++ standard cmath library. btw, here is my code:
    #include
    #include
    using namespace std;
    class geometry{
    int x,y;
    public:
    // parametrized function to initailize the value of the variables
    geometry(int a, int b){
    x = a;
    y = b;
    }
    // print_point() : to print the formed point.
    void print_point(){
    cout

    • @naman1312
      @naman1312 Рік тому

      My answer 😀 :
      Answer to the easy quiz.
      (For those who don't know these functions which I have used, read this then see the answer.)
      To do some basic math operations, we need to import header file .
      sqrt function --> It calculates the square root of a number.
      pow function --> It calculates the exponent of a number. It takes two parameters - the number to be powered and the power which has to be raised to that number.
      The code for the answer to this quiz:
      #include
      #include
      using namespace std;
      class Point{
      int x, y;
      friend float distance(Point, Point);
      public:
      Point(int a, int b){
      x = a;
      y = b;
      }
      void displayPoint(){
      cout

  • @JOYDIPMANNA-fr6op
    @JOYDIPMANNA-fr6op 3 роки тому +3

    Your coding skills improve my skills

  • @vivekshah2569
    @vivekshah2569 2 роки тому

    harry bhaiya boht kuch sikhne mil raha hai.... thank you

  • @altamashsabri8142
    @altamashsabri8142 4 роки тому +5

    best tutorial on C++

  • @MuhammadRiyan-wn8wu
    @MuhammadRiyan-wn8wu 7 місяців тому

    #include
    #include
    using namespace std;
    class quiz{
    int a,b;
    public:
    void give( int x ,int y ){
    a=x;
    b=y;
    }
    friend void diff(quiz,quiz);
    };
    void diff(quiz o1, quiz o2){
    int c,d;
    c=(o2.a-o1.a)*(o2.a-o1.a);
    d=(o2.b-o1.b)*(o2.b-o1.b);
    cout

  • @karangoyal8904
    @karangoyal8904 3 роки тому +3

    float distance (point m,point n)
    {
    float z=sqrt ((n.x-m.x)*(n.x-m.x)+(n.y-m.y)*(n.y-m.y)
    Cout

  • @i_write7500
    @i_write7500 Рік тому

    Thank you so much

  • @krishmehta5418
    @krishmehta5418 4 роки тому +7

    project completed succesfully

  • @bugsfounder
    @bugsfounder 2 роки тому +1

    float distance(Point o1, Point o2)
    {
    float d = sqrt(pow(o2.x - o1.x, 2) + pow(o2.y - o1.y, 2));
    return d;
    }

  • @shuvam0516
    @shuvam0516 4 роки тому +30

    Hello harry vai,
    I am from Nepal . It has been all most 2-3 weeks learning python from your python playlist . The project that you have done are very appreciable,hands off for that but you have missed an important project of python and i.e. Face recognition system . I hope you will make an tutorial video for it . And thanks for sharing your knowledge and experience with us .....
    God Bless you .

    • @animeshmaji9515
      @animeshmaji9515 4 роки тому

      yes I support

    • @mukeshkashyap1279
      @mukeshkashyap1279 4 роки тому +3

      Heyy budd, tell your pm oli that
      He is gonna destroy your country

    • @shuvam0516
      @shuvam0516 4 роки тому +6

      @@mukeshkashyap1279
      Are you learning programming to discuss these shit things on the comments section .
      As my observations, oli keeps vomiting shits from his mouth on International topics which every Nepali knows, BUT inside the country there has been a lot of developmental in his governance .

    • @kushal6065
      @kushal6065 3 роки тому +1

      @@mukeshkashyap1279 STFU

  • @vireshkamlapure4169
    @vireshkamlapure4169 3 роки тому +2

    14:33 Done

  • @annadarout8949
    @annadarout8949 4 роки тому +3

    Hi Harry Bhai.......... Thank you so much .....I'm in class 8 but coding mein bahut interest hai.......ek bar khatam ho Jaye phir dhammal mach jaye

    • @dangergamimg1933
      @dangergamimg1933 3 роки тому +3

      Mcha Di dhmaal phir

    • @a.nmolll
      @a.nmolll 3 роки тому +1

      iam in nursery...iam also very interested in coding ...dhamkal mcha denge

    • @rajaryan4647
      @rajaryan4647 3 роки тому +2

      I have born today just 368584744351799....micro second ago..... I am also very interested in coding....dhamaal macha denge.

    • @amitsingh-yk3ps
      @amitsingh-yk3ps 3 роки тому +1

      im have just died abhi 4 th dimension me hu,i am also very interested ek baar janam lelu phir dhamal macha denge

  • @udaydarade5710
    @udaydarade5710 Рік тому +1

    //quiz - a function which takes two points and computes the distance between
    //make it a friend function
    //following program doesn't need constructor
    #include
    #include
    using namespace std;
    class point
    {
    int a;
    int b;
    friend float distance(point , point);
    public:
    void coordinate(){

    cout

  • @mohakdas143
    @mohakdas143 2 роки тому +4

    // This program is written by using the concept of friend function, parameterized constructor.
    // This program is valid for any point as it takes point as an input from the user.
    #include
    #include
    using namespace std;
    class point
    {
    private:
    int x;
    int y;
    public:
    friend void distance(point, point);
    point(int a, int b);
    void getpoint(void)
    {
    cout

  • @adnanbarwatiya5459
    @adnanbarwatiya5459 3 роки тому +1

    thanks for this videos

  • @prashantmajumdar1519
    @prashantmajumdar1519 4 роки тому +130

    Program:----
    #include
    #include
    Using namespace std;
    Class point{
    Int x,y;
    Public:
    point(int a,int b){
    x=a;
    y=b; }
    Void display (){
    Cout

    • @uraniumgaming123
      @uraniumgaming123 3 роки тому +2

      Nice

    • @FANSasFRIENDS
      @FANSasFRIENDS 3 роки тому

      A slight mistake here u put some words capital like Class but it should be class and same with Using,int,court...

    • @prashantmajumdar1519
      @prashantmajumdar1519 3 роки тому +3

      @@FANSasFRIENDS bro I know but thing is concept clear hona chahiye syntax error to aaram se theek ho sakta hai

    • @Rohan-ov3fr
      @Rohan-ov3fr 3 роки тому +4

      @@prashantmajumdar1519 bro how you done this because I m not able to do this in first attempt So can u guide hiw you can understand his vedio plz bro

    • @prashantmajumdar1519
      @prashantmajumdar1519 3 роки тому +3

      @@Rohan-ov3fr bhai itna kuch nahi hai bass consistent raho and maine ye playlist bohot focus rehke follow kia hai to mujhse ho gaya I will suggest you to solve atleast 2-3 coding problem per day to increase your problem solving skill

  • @aviralsingh8469
    @aviralsingh8469 Рік тому

    void Distance(Point c1, Point c2){
    float c = sqrt(pow(((c1.x)-(c2.x)),2)+pow(((c1.y)-(c2.y)),2));
    cout

  • @koushik7604
    @koushik7604 3 роки тому +6

    I think friend function ki zaroorat nahi hai:
    // a member function to compute the distance between two poins
    double computeDistance(Point new_point)
    {
    double d;
    d = sqrt(pow((Point::x - new_point.x), 2) + pow((Point::y - new_point.y), 2));
    return d;
    }
    int main()
    {
    // driver program
    Point p(1, 1);
    p.displayPoint();
    Point q(4, 6);
    q.displayPoint();
    cout

    • @kushal6065
      @kushal6065 3 роки тому

      I didn't understand that -->"d = sqrt(pow((Point::x - new_point.x), 2) + pow((Point::y - new_point.y), 2)); ".
      What does that *Point::x - new_point.x* means?

    • @koushik7604
      @koushik7604 3 роки тому +2

      @@kushal6065 we are computing Euclidean distance...which means square root of sum of squares of component wise subtraction

  • @_TheInquistive
    @_TheInquistive 10 місяців тому +1

    Now every point is my friend😊
    #include
    #include
    using namespace std;
    class vector
    {
    int x,y;
    public :
    vector(int,int);
    void dis(void);
    friend void distance(vector o1,vector o2);
    };
    vector ::vector(int a,int b)
    {
    x=a;
    y=b;
    }
    void vector::dis(void)
    {
    cout

  • @arnavmaheshwari6149
    @arnavmaheshwari6149 2 роки тому +38

    My code is correct and I can't believe it

  • @shubhamlala1873
    @shubhamlala1873 2 роки тому +1

    solution of question---
    #include
    #include
    using namespace std;
    class point{
    int a,b;
    friend void distance(point o1, point o2);
    public:
    point(int x , int y);
    void display(void){
    cout

  • @abhishekrawat8074
    @abhishekrawat8074 2 роки тому +25

    My code:
    // Exercise question
    // Create a function (hint:make it a friend function) which takes two point objects
    // and computes the distence between those two points
    #include
    #include
    using namespace std;
    class point
    {
    int x, y;
    public:
    friend void distance(point o1, point o2);
    point(int num1, int num2)
    {
    x = num1;
    y = num2;
    }
    void display()
    {
    cout

  • @sagarbarahi3569
    @sagarbarahi3569 Рік тому

    Awesome explanation..
    Begineers easily understood ur language .but a little bit problem is present in your video that is your example to explain..In your video u will take only mathematical example which easily understood by a math background students ...but it's so hard to understood by a non math student...so plizz sir took some easier example to teach....

  • @umeshbhatt2570
    @umeshbhatt2570 4 роки тому +6

    first bhai heart dedo.. Python playlist complete hone wali h

  • @DhvanitMonpara
    @DhvanitMonpara 9 місяців тому

    // create a function which takes two point object and computes the distance between those two points
    // Hint: make it a friend function
    #include
    #include
    using namespace std;
    class point
    {
    int x;
    int y;
    public:
    point(int, int);
    friend void distance(point a, point b);
    };
    point::point(int u, int v)
    {
    x = u;
    y = v;
    }
    void distance(point a, point b)
    {
    int n1 = (b.x - a.x);
    int n2 = (b.y - a.y);
    cout

  • @programmingwithjavascript3579
    @programmingwithjavascript3579 3 роки тому +3

    Harry bhai always best👍💯 💞

  • @justatharav9139
    @justatharav9139 Рік тому +1

    // by taking inputs from user calulating distance between two points.
    #include
    #include
    using namespace std;
    class input //taking inputs from users
    {
    int x1;
    int x2;
    int y1;
    int y2;
    friend void distance(input );
    public:
    input()
    {
    couty1;
    couty2;
    }
    };
    void distance(input a1)
    {

    float pdiffx=pow((a1.x2-a1.x1),2);
    float pdiffy=pow((a1.y2-a1.y1),2);
    float tdis=sqrt(pdiffx+pdiffy);
    cout

  • @thesportsman3122
    @thesportsman3122 4 роки тому +10

    Hello, I'm from Pakistan.
    I have 2 Questions..
    1. Python k hawaly se kafi videos YT per uoload hain, jin may aap ka bhi kafi contribution hay, sub coding sekhatay hain Laken abhi tak kisi ne nahi bataya keh jub hum coding ker k Koey program bana daitay hain, tho os KA .exe file kaisay banatay hain, our doosray computer may kaisay apnay software ya Program ko install karay.
    2.kia aap Koey aisa program, software, vba, excel sheet, bana saktay hain jis may hum kuch data enter karay our wo Autocad may draw ya plot ho jaey..
    Kafi programmers ko msg our comment kia but abhi tak kisi ne reply nahi kia. Shayad aap bhi aisa na ker sako... ❤️

  • @ArmaanKhan-xs3ub
    @ArmaanKhan-xs3ub 11 місяців тому

    Nice job ❤

  • @swethachilveri4123
    @swethachilveri4123 4 роки тому +283

    // parameterized constructors
    #include
    #include
    using namespace std;
    class point{
    int x;
    int y;
    public :
    friend void difference(point , point);
    point(int a, int b){
    x=a;
    y=b;
    }
    void displaypoint(){
    cout

  • @luvkushsharma1586
    @luvkushsharma1586 2 роки тому +3

    /*
    Create a function which takes 2 point objects and computes the distance between those points
    */
    #include
    #include
    using namespace std;
    class Point{
    int x,y; // Private members
    // Making distanceBetweenPoints as a friend of class Point. So, that we can access the private members of the class Point.
    friend double distanceBetweenPoints(Point,Point);
    public:
    // Default constructor
    Point(void){
    x = 0;
    y = 0;
    }
    // Parameterized Constructor
    Point(int a, int b){
    x = a;
    y = b;
    }
    // Function declaration
    double distanceBetweenPoints(Point , Point );
    void displayPoint(){
    cout

    • @life-oh1bc
      @life-oh1bc Рік тому +1

      I like your spacious way of writing code

  • @malikhassan2830
    @malikhassan2830 Рік тому

    xd distance wala question khud se hogya 🥺💖 ily harry

  • @shubhrai5385
    @shubhrai5385 2 роки тому +5

    it's interesting to see how video by video views are decreasing...lol ...only serious people left...dammm

  • @harshavardhandusane6223
    @harshavardhandusane6223 Рік тому

    Thanks sir

  • @anti-bug
    @anti-bug 2 роки тому +3

    The answer of quiz -->
    #include
    #include
    using namespace std;
    class Point{
    int x, y;
    friend int distance(Point, Point);
    public:
    Point(int a, int b){
    x = a;
    y = b;
    }
    void displayPoint(void){
    cout

    • @factzbaba94
      @factzbaba94 2 роки тому

      Bhai boht mast code hai 😍👍

  • @ojaspatil2094
    @ojaspatil2094 2 роки тому

    8:50 tbc

  • @D-Coder440
    @D-Coder440 Рік тому

    Thank you Harry Bro ❣️

  • @anantmishra5295
    @anantmishra5295 2 роки тому +3

    The solution for to find the distance between:
    float distence(Points p, Points q){
    float result;
    result = sqrt((((q.x)-(p.x))*((q.x)-(p.x))) + (((q.y)-(p.y))*((q.y)-(p.y))));
    return result;
    }
    This will give the exact value of the distance between points.
    Thank You!

  • @muhammadareebkazmi9476
    @muhammadareebkazmi9476 2 роки тому

    Thank you, Harry bhai!

  • @LoveIsLifeTurkishIndia
    @LoveIsLifeTurkishIndia 4 роки тому +6

    Can u suggest me a laptop for programming and further use android development and for after effects .

  • @royfamily9273
    @royfamily9273 2 роки тому

    Thanks Harry Bhaiya

  • @anuvanshkshatriya7268
    @anuvanshkshatriya7268 Рік тому +8

    //finding distance between two points using friend function
    #include
    #include
    using namespace std;
    class Point
    {
    int x, y;
    public:
    Point(int a, int b){
    x = a;
    y = b;
    }
    void displayPts(){
    cout

    • @satender1616
      @satender1616 Рік тому +1

      Ya same program letus C book mai bhi hai

    • @anuvanshkshatriya7268
      @anuvanshkshatriya7268 Рік тому +1

      @@satender1616 bhai pr meine toh khud hi code kra hai ,baki ap us book mei se krlo agr same hai toh

  • @aiexplorations-cv1js
    @aiexplorations-cv1js Рік тому +1

    Distance Between two Points :
    #include
    #include
    using namespace std;
    class Complex{
    private :
    double a, b;
    public :
    // Complex(void)); // Default Constructors
    Complex(int , int); // Parametrized Constructors
    void printNumber(){
    cout

  • @abhijitpramanick3319
    @abhijitpramanick3319 2 роки тому +4

    12:19
    //More examples of Parameterised Constructors
    #include
    #include
    using namespace std;
    class Point{
    int x, y;
    friend float distance(Point, Point);
    public:
    Point(int a, int b){
    x = a;
    y = b;
    }
    void pointDisplay(){
    cout

  • @kumkumbhagya51
    @kumkumbhagya51 Рік тому

    13:09 ye kaisa formula de diye bhaiya😵

  • @somnathgolhar2917
    @somnathgolhar2917 2 роки тому +4

    // Create a function which takes two points objects and compute the pointe between those points
    #include
    #include
    using namespace std;
    class pointe{
    private:
    int x;
    int y;
    public:
    friend float pointe_compute(pointe e1,pointe e2);
    pointe(int x1,int y1){
    x=x1;
    y=y1;
    }
    };
    float pointe_compute(pointe e1,pointe e2){
    int x1=e1.x;int x2=e2.x;int y1=e1.y;int y2=e2.y;
    float sub1=pow(x2-x1,2);
    float sub2=pow(y2-y1,2);
    float fin1=sqrt(sub1+sub2);
    return fin1;
    }
    int main(){
    pointe r1(1,3);
    pointe r2(7,6);
    float a=pointe_compute(r1,r2);
    cout

    • @anonymous_ghost_123
      @anonymous_ghost_123 Рік тому

      can we dont directly use function inside the class instead of using friend function

  • @Tajinder0singh
    @Tajinder0singh 5 місяців тому +1

    12:38
    //! A Slightly Alternate Solution.
    #include
    #include
    #include
    using namespace std;
    //+ Practice Question
    //*Q.Create a function which takes 2 point objects and computes the distance between those 2 points.
    class Point
    {
    private:
    int x , y;
    friend float distanceCalculator(Point , Point);
    friend void diplayPointDistance(Point , Point);
    public:
    Point(int a , int b)
    {
    x = a;
    y = b;
    }
    void displayPoint()
    {
    cout

  • @EC__MohammadArshad
    @EC__MohammadArshad 2 роки тому +3

    Distance_between_two_points
    Easy Method :
    #include
    #include
    using namespace std;
    class point
    {
    int x, y;
    friend void distance_between_two_points(point, point);
    public:
    point(int a, int b)
    {
    x = a;
    y = b;
    }
    void DisplayPoints()
    {
    printf("The point is (%d + %d)
    ", x, y);
    }
    };
    void distance_between_two_points(point p, point q)
    {
    double distance = sqrt((pow((q.x - p.x), 2)) + (pow((q.y - p.y), 2)));
    cout

  • @abhinavtripathi9678
    @abhinavtripathi9678 2 роки тому

    Outro is really nice...

  • @SahilKumar-ni7su
    @SahilKumar-ni7su 4 роки тому +50

    10:30 interent mera aa nhi rha hai mai game khelunga lol :)

    • @MdSalim-yj2gl
      @MdSalim-yj2gl 3 роки тому

      Isi comment k liye to vdo pause kr k aaya hu xD

  • @balveersinghbhatia
    @balveersinghbhatia 2 роки тому

    Thankyou harry bhai so much

  • @priyankagosavi7526
    @priyankagosavi7526 4 роки тому +2

    Sir please post the solution of the quiz you gave us 🙏🏻

  • @tusharsahu8831
    @tusharsahu8831 Рік тому

    i have done solved this quiz in two ways ::
    1... by using constructurs
    #include
    #include
    using namespace std;
    class Point
    {
    int x, y;
    friend Point net(Point p, Point q);
    public:
    Point(int a, int b)
    {
    x = a;
    y = b;
    }
    void distance()
    {
    float ans = sqrt(x * x + y * y);
    cout

  • @RohanDasRD
    @RohanDasRD 4 роки тому +8

    Kal se boards start hai mera.. to bhai ye 28th tak channel pe active nahi reh paunga bhai. Uske baad dhoom machaunga♥️

    • @anoopkumarshukla6808
      @anoopkumarshukla6808 4 роки тому +1

      Rohan das ...sir ka bhai h kya?????????

    • @divyanshupatil4702
      @divyanshupatil4702 4 роки тому +2

      @@anoopkumarshukla6808 no, but he is active viewer who is connected form the very starting with harry bhaii

  • @merwinsamuel6766
    @merwinsamuel6766 4 роки тому +3

    C++ Vs Java for competitive programming?

  • @anantagarwal5150
    @anantagarwal5150 9 місяців тому

    I did it in a different way where we can call value .
    //This is a program on how to calculate a distance of coordinate points using class
    #include
    #include
    using namespace std;
    class point{
    int a;
    int b;
    int count;
    friend void distance(point , point);
    public:
    void setdata(void){
    cout

  • @mohammedsamiuddin3736
    @mohammedsamiuddin3736 4 роки тому +4

    Assalamualaikum, Harry Bhai
    Bhai aap ek konsa CPU lena best programming ke liye aur Gaming ke liye aur youtube purpose live streaming ke liye pls Isper ek video na bhai....

    • @codewithgagan
      @codewithgagan 4 роки тому

      minimum i3 processor ke sath 4gb ram

    • @shuvam0516
      @shuvam0516 4 роки тому

      Quad core i5 with 8 gb ram + 2-4 gb GPU or AMD ryzen r5 with 8 gb ram + 2-4 gb GPU.

  • @oshinomeme-zb3fk
    @oshinomeme-zb3fk Рік тому

    Solution:
    void printDistance(Point a, Point b){
    cout

  • @raginigour4510
    @raginigour4510 4 роки тому +4

    When you will give solution of your question

  • @factzone4453
    @factzone4453 4 роки тому +4

    25000 budget me konsa cpu badia rahega harry bhai...
    I already have monitor.

  • @anjalirani3239
    @anjalirani3239 Рік тому

    I did the distance question after more than 8 errors thank you harry bhaiya😇

  • @ritikabali6466
    @ritikabali6466 3 роки тому +6

    11:59 yahan pe ye kyu ro raha hai ...xD lol

  • @Tojasv
    @Tojasv 3 місяці тому

    //Creating a function which takes 2 point objects and computes the distance between thoe 2 points:
    //(Hint: Make it friend function)
    #include
    #include
    using namespace std;
    class Point{
    int x,y;
    friend void distancePoints(Point o1, Point o2);
    public:
    Point(int a, int b){
    x = a;
    y = b;
    }
    void displayPoint(){
    cout