salut a tous je débute en c++ et j'ai de nombreuse erreurs que je ne sais pas résoudre:
en gros je doit réaliser une classe point qui permet de manipuler un point du plan.
j'ai les erreurs suivantes:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 Compilateur: Default compiler Building Makefile: "C:\Dev-Cpp\Makefile.win" Exécution de make... make.exe -f "C:\Dev-Cpp\Makefile.win" all g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" main.cpp:3:21: pointtt.h: No such file or directory main.cpp: In function `int main()': main.cpp:9: error: `point' undeclared (first use this function) main.cpp:9: error: (Each undeclared identifier is reported only once for each function it appears in.) main.cpp:9: error: expected `;' before "p1" main.cpp:10: error: expected `;' before "p2" main.cpp:11: error: expected `;' before "p3" main.cpp:12: error: `p1' undeclared (first use this function) main.cpp:12: error: expected primary-expression before '<<' token main.cpp:13: error: `p2' undeclared (first use this function) main.cpp:13: error: expected primary-expression before '<<' token main.cpp:18: error: expected primary-expression before '<<' token main.cpp:19: error: expected primary-expression before '<<' token main.cpp:20: error: expected primary-expression before '<<' token make.exe: *** [main.o] Error 1 Exécution terminée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include <cstdlib> #include <iostream> #include <pointtt.h> using namespace std; int main() { point p1; point p2; point p3(10,15),p4(20,30); cout<<"p1="<<p1.affiche();<<endl; cout<<"p2="<<p2.affiche();<<endl; p1.saisir(); p2.saisir(); p1.deplace(17,65); p2.deplace(18,686); cout<<"apres deplacement p1="<<p1.affiche();<<endl; cout<<"apres deplacement p2="<<p2.affiche();<<endl; cout<<"dist entre p1 et p3"<<p1.dist();<<endl; system("PAUSE"); return EXIT_SUCCESS; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 #include<iostream> using namespace std; #include<math.h> #include"pointttt.h" point ::point() { x=0; y=0; } point::point(double a, double b) { this->x=a; this->y=b; } void point::affiche () { cout<<"x="<<this->x<<endl; cout<<"y="<<this->y<<endl; } void point::deplace(double dx,double dy) { this->x=dx; this->y=dy; } void point:: saisir() { cout<<"saisir x"; cin>>this->x; cout<<"saisir y"; cin>>this->y; } double point::distance(point p) { return sqrt(x*dx+y*dy); } point point::milieu(&point p) { point px; px((this->x+dx/2),(this->y+dy/2)); return px; }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include<iostream> using namespace std; #inlude<math.h> class point { private: double x; double y; public: point(); point(double dx, double dy); void affiche(); void saisir(); double distance(pont p); point milieu(point p); void deplace(double dx,double dy); };
Partager