carré
This commit is contained in:
parent
ca49bd84aa
commit
241e3111ab
|
|
@ -0,0 +1,28 @@
|
|||
#include <iostream>
|
||||
#include "Robot.h"
|
||||
|
||||
int Robot::getErrorCode() {
|
||||
|
||||
return 42;
|
||||
}
|
||||
|
||||
int Robot::getRobotType() {
|
||||
|
||||
std::cout << "Robot de fou furieux" << std::endl;
|
||||
}
|
||||
|
||||
int robotique() {
|
||||
// Create an instance of the Robot class
|
||||
Robot myRobot;
|
||||
|
||||
// Call the moveForward() function
|
||||
myRobot.getErrorCode();
|
||||
|
||||
// Call the turnLeft() function
|
||||
myRobot.getRobotType();
|
||||
|
||||
// Optionally, you can do more with the robot here
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
class Robot {
|
||||
public:
|
||||
int getErrorCode();
|
||||
int getRobotType();
|
||||
};
|
||||
int robotique();
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#include <iostream>
|
||||
#include "Robot.h"
|
||||
|
||||
int main() {
|
||||
robotique(); // Call the robotique() function
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Makefile for compiling and linking your C++ project
|
||||
|
||||
# Compiler
|
||||
CXX = g++
|
||||
|
||||
# Compiler flags
|
||||
CXXFLAGS = -std=c++11 -Wall -Wextra
|
||||
|
||||
# Source files (Add your CPP files here)
|
||||
SRCS = main.cpp Robot.cpp
|
||||
|
||||
# Object files
|
||||
OBJS = $(SRCS:.cpp=.o)
|
||||
|
||||
# Executable name
|
||||
EXEC = my_program
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
# Default target
|
||||
all: $(EXEC)
|
||||
|
||||
# Linking
|
||||
$(EXEC): $(OBJS)
|
||||
$(CXX) $(CXXFLAGS) $(OBJS) -o $@
|
||||
|
||||
# Compilation
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# Clean up object files and executable
|
||||
clean:
|
||||
rm -f $(OBJS) $(EXEC)
|
||||
|
||||
Loading…
Reference in New Issue