First commit
This commit is contained in:
21
IUT/Info1/TD/Exercices/7.2_selon/calc.cpp
Normal file
21
IUT/Info1/TD/Exercices/7.2_selon/calc.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <limits>
|
||||
#include "calc.h"
|
||||
|
||||
float add(float a, float b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
float sub(float a, float b) {
|
||||
return a - b;
|
||||
}
|
||||
|
||||
float mul(float a, float b) {
|
||||
return a * b;
|
||||
}
|
||||
|
||||
float div(float a, float b) {
|
||||
if (b != 0) {
|
||||
return a / b;
|
||||
}
|
||||
return std::numeric_limits<double>::infinity();
|
||||
}
|
||||
Reference in New Issue
Block a user