Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
100%

FIX ERRORS GIVEN IN IMAGE

#include<iostream>

#include<math.h>

#include<assert.h>

using namespace std;

typedef float f;

class vector3d

{

public:

    f x,y,z;

    vector3d()      {

        x=0;

        y=0;

        z=0;

    }

 

    vector3d(f x1,f y1,f z1=0)        {

        x=x1;

        y=y1;

        z=z1;

    }

    vector3d(const vector3d &vec);   

    vector3d operator+(const vector3d &vec);  

    vector3d &operator+=(const vector3d &vec);

    vector3d operator-(const vector3d &vec);  

    vector3d &operator-=(const vector3d &vec);

    vector3d operator*(f value);    //multiplication

    vector3d &operator*=(f value);  //assigning new result to the vector.

    vector3d &operator/=(f value); 

    vector3d &operator=(const vector3d &vec);

bool coplanar(vector3d p,vector3d q,vector3d r,vector3d s);

    f dot_product(const vector3d &vec);

    vector3d cross_product(const vector3d &vec);

    f magnitude();

    vector3d normalization();  

    f square();

    f distance(const vector3d &vec);    //gives distance between two vectors

    f show_X(); //return x

    f show_Y(); //return y

    f show_Z(); //return z

    void disp();    //display value of vectors

};

vector3d::vector3d(const vector3d &vec)

{

    x=vec.x;

    y=vec.y;

    z=vec.z;

}

vector3d vector3d::bool coplanar(vector3d p,vector3d q,vector3d r,vector3d s);

{

    a=distance(const vector3d &p);

    b=distance(const vector3d &q);

    e=distance(const vector3d &r);

    c=distance(const vector3d &s);

    d=a*p+b*q+c*d;

    if(d==0)

    {

        return true;   

   }

    else {return false;}

}

vector3d vector3d ::operator+(const vector3d &vec)

{

    return vector3d(x+vec.x,y+vec.y,z+vec.z);

}

vector3d &vector3d ::operator+=(const vector3d &vec)

{

    x+=vec.x;

    y+=vec.y;

    z+=vec.z;

    return *this;

}

//substraction//

vector3d vector3d ::operator-(const vector3d &vec)

{

    return vector3d(x-vec.x,y-vec.y,z-vec.z);

}

vector3d &vector3d::operator-=(const vector3d &vec)

{

    x-=vec.x;

    y-=vec.y;

    z-=vec.z;

    return *this;

}

//scalar multiplication

vector3d vector3d ::operator*(f value)

{

    return vector3d(x*value,y*value,z*value);

}

vector3d &vector3d::operator*=(f value)

{

    x*=value;

    y*=value;

    z*=value;

    return *this;

}

vector3d &vector3d ::operator/=(f value)

{

    assert(value!=0);

    x/=value;

    y/=value;

    z/=value;

    return *this;

}

vector3d &vector3d::operator=(const vector3d &vec)

{

    x=vec.x;

    y=vec.y;

    z=vec.z;

    return *this;

}

 

f vector3d::dot_product(const vector3d &vec)

{

    return x*vec.x+vec.y*y+vec.z*z;

}

 

vector3d vector3d ::cross_product(const vector3d &vec)

{

    f ni=y*vec.z-z*vec.y;

    f nj=z*vec.x-x*vec.z;

    f nk=x*vec.y-y*vec.x;

    return vector3d(ni,nj,nk);

}

 

f vector3d::magnitude()

{

    return sqrt(square());

}

f vector3d::square()

{

    return x*x+y*y+z*z;

}

vector3d vector3d:: normalization()

{

    assert(magnitude()!=0);

    *this/=magnitude();

    return *this;

}

f vector3d::distance(const vector3d &vec)

{

    vector3d dist=*this-vec;

    return dist.magnitude();

}

f vector3d::show_X()

{

    return x;

}

f vector3d::show_Y()

{

    return y;

}

 

f vector3d::show_Z()

{

    return z;

}

void vector3d::disp()

{

    cout<<x<<" "<<y<<" "<<z<<endl;

    if(x<y)

    cout<<"coplanar";

    else

    cout<<"No coplanar";

}

 

int main()

{

    vector3d a=vector3d(2,5,7);

    vector3d b=vector3d(3,7,10);

    vector3d d=vector3d(3,4,11);

    vector3d c=a+b+d;

    c.disp();

// call other functions

}

> clang++-7 -pthread -std=c++17 -o main main.cpp
main.cpp:95:20: error: expected unqualified-id
vector3d vector3d::bool coplanar (vector3d p, vector3d q, vector3d r,vector3d s);
main.cpp:97:1: error: expected unqualified-id
{
2 errors generated.
compiler exit status 1
expand button
Transcribed Image Text:> clang++-7 -pthread -std=c++17 -o main main.cpp main.cpp:95:20: error: expected unqualified-id vector3d vector3d::bool coplanar (vector3d p, vector3d q, vector3d r,vector3d s); main.cpp:97:1: error: expected unqualified-id { 2 errors generated. compiler exit status 1
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY