#include <iostream>
using namespace std;
// declare class name
class vecteur3d
{
float x, y, z ;
public :
//constructeur
vecteur3d (float, float, float) ;
//tester si deux vecteurs coincident
bool coincide (vecteur3d v);
//afficher les composantes
void affiche();
//calculer la somme
vecteur3d somme(vecteur3d v);
//calculer le produit scalaire
float prodscalaire(vecteur3d v)
} ;
//constructeur
vecteur3d :: vecteur3d (float c1, float c2, float c3)
{
x = c1 ; y = c2 ; z = c3 ;
}
//coincidence
bool vecteur3d::coincide(vecteur3d v) {
return (x==v.x && y==v.y && z==v.z);
}
//affichage
void vecteur3d::affiche(){
cout <<"("<<x<<","<<y<<","<<z<<")"
<<endl;
}
//somme
vecteur3d :: vecteur3d::somme(vecteur3dv){
return (x+v.x, y+v.y, z+v.z);
}
//produit scalaire
float vecteur3d::prodscalaire(vecteur3d v)
{
return
}
To embed this project on your website, copy the following code and paste it into your website's HTML: