## coord.cpp ```cpp #include <iostream> #include "coord.hpp" using namespace std; struct Coord { int x; int y; }; Coord creeCoord(int lig, int col){ Coord c; c.x = lig; c.y = col; return c; } void afficheCoord(Coord c){ cout<<"("<<C.x<<", "<<C.y<<")"<<endl; } int getX(Coord c){ return c.x; } int getY(Coord c){ return c.y; } bool egalCoord(Coord c1, Coord c2) { return (c1.x==c2.x and c1.y==c2.y); } void testEgalCoord(){ ASSERT( egalCoord(creeCoord(5, 6), creeCoord(5, 6))); ASSERT(!egalCoord(creeCoord(3, 5), creeCoord(4, 5))); ASSERT(!egalCoord(creeCoord(1, 19), creeCoord(19, 1))); } int main(){ Coord c1 = creeCoord(2,1); afficheCoord(c1); cout << endl; testEgalCoord(); return 0; } ``` ## coord.hpp ```cpp #include <iostream> using namespace std; struct Coord { int x; int y; }; Coord creeCoord(int lig, int col); void afficheCoord(Coord c); int getX(Coord c); int getY(Coord c); bool egalCoord(Coord c1, Coord c2); void testEgalCoord(); ``` ### testcoord.cpp ```cpp #include <iostream> #include "coord.hpp" #define ASSERT(C) if ( !(C) ) { std::cerr << "Test failed: "#C << std::endl; } using namespace std; int main(){ Coord c; c=creeCoord(8,9); afficheCoord(c); cout<<getX(c)<<" "<<getY(c)<<endl; return 0; } ```