Update 0.2.6
This commit is contained in:
parent
58eec7ed22
commit
3a0cb7078c
11 changed files with 95 additions and 61 deletions
54
utils/calc.c
Normal file
54
utils/calc.c
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "calc.h"
|
||||
#include "../etc/math_ext.h"
|
||||
#include "logger.h"
|
||||
|
||||
void startCalc(){
|
||||
logger("Started calculator.");
|
||||
char op;
|
||||
printf("Calculator - Version 0.1\n\n");
|
||||
|
||||
do{
|
||||
printf("\nOperation (h for help): ");
|
||||
scanf("%c", &op);
|
||||
chooseOperation(op);
|
||||
}while(op != 'q');
|
||||
|
||||
|
||||
}
|
||||
|
||||
void chooseOperation(char op){
|
||||
logger("Operation choosen: " + op);
|
||||
|
||||
switch(op){
|
||||
case '1': { OP_1(); break;};
|
||||
case 'h': { listOperations(); break;};
|
||||
case 'q': {/*do nothing bcause auto break*/ break;}
|
||||
default: { /*do none*/ break;};
|
||||
}
|
||||
}
|
||||
|
||||
void listOperations(){
|
||||
printf("Operations List: \n\n");
|
||||
printf("1 - Addition\n");
|
||||
printf("2 - Subtraction\n");
|
||||
printf("3 - Multiply\n");
|
||||
printf("4 - Divide\n");
|
||||
}
|
||||
|
||||
void OP_1(){
|
||||
double x, y;
|
||||
printf("1. Number: \n");
|
||||
scanf("%lf", &x);
|
||||
printf("2. Number: \n");
|
||||
scanf("%lf", &y);
|
||||
printf("\n Result: %lf\n", Add(x,y));
|
||||
}
|
||||
|
||||
int getNumber(){
|
||||
int no;
|
||||
scanf("%d", &no);
|
||||
|
||||
return no;
|
||||
}
|
||||
12
utils/calc.h
Normal file
12
utils/calc.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _CALC_H_
|
||||
#define _CALC_H_
|
||||
|
||||
void startCalc();
|
||||
void chooseOperation(char op);
|
||||
void listOperations();
|
||||
int getNumber();
|
||||
|
||||
//Operations
|
||||
void OP_1();
|
||||
|
||||
#endif
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#include "update_check.h"
|
||||
#include "logger.h"
|
||||
|
||||
#define DEFAULT_IP "192.168.0.32"
|
||||
#define DEFAULT_IP "127.0.0.1"
|
||||
|
||||
int checkForUpdate(char ver[10]){
|
||||
int sock;
|
||||
|
|
|
|||
Reference in a new issue