You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
663 B
C++
39 lines
663 B
C++
#include <iostream>
|
|
|
|
#include "webcc/logger.h"
|
|
|
|
#include "calc_client.h"
|
|
|
|
int main() {
|
|
LOG_INIT("", webcc::LOG_CONSOLE);
|
|
|
|
CalcClient calc;
|
|
|
|
double x = 1.0;
|
|
double y = 2.0;
|
|
double result = 0.0;
|
|
|
|
if (calc.Add(x, y, &result)) {
|
|
printf("add: %.1f\n", result);
|
|
}
|
|
|
|
if (calc.Subtract(x, y, &result)) {
|
|
printf("subtract: %.1f\n", result);
|
|
}
|
|
|
|
if (calc.Multiply(x, y, &result)) {
|
|
printf("multiply: %.1f\n", result);
|
|
}
|
|
|
|
if (calc.Divide(x, y, &result)) {
|
|
printf("divide: %.1f\n", result);
|
|
}
|
|
|
|
// Try to call a non-existing operation.
|
|
if (calc.NotExist(x, y, &result)) {
|
|
printf("not_exist: %.1f\n", result);
|
|
}
|
|
|
|
return 0;
|
|
}
|