Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7e089515a | ||
|
|
364fb988e6 | ||
|
|
f006d56ba6 | ||
|
|
8337168b18 | ||
|
|
6bacd41503 | ||
|
|
c6b12cf78e | ||
|
|
78d882b0f6 |
@@ -4,3 +4,4 @@ cmake-buid-debug
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
Debug
|
||||
@@ -8,9 +8,8 @@
|
||||
* Хромова Полина
|
||||
|
||||
## Части задачи
|
||||
- GPIO + GPIO в контексте Atmega328. Pull up, Pull down (Кристина Бочкина/Полина Хромова)
|
||||
- Реализация клавиатуры (Кристина Бочкина/Полина Хромова)
|
||||
- SPI интерфейс + SPI у Atmega328 (Никита Уткин)
|
||||
- GPIO + GPIO в контексте Atmega328. Pull up, Pull down (Михаил Батухтин/Уткин Никита)
|
||||
- Физическая реализация клавиатуры (Кристина Бочкина/Полина Хромова)
|
||||
- SPI интерфейс + SPI у Atmega328 (Кристина Бочкина)
|
||||
- Программная реализация клавиатуры (Полина Хромова)
|
||||
- Архитектура ПО (Михаил Батухтин)
|
||||
|
||||
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
double calculate(char op, double num1, double num2) {
|
||||
double result = 0;
|
||||
switch (op) {
|
||||
case '+':
|
||||
result = num1 + num2;
|
||||
break;
|
||||
case '-':
|
||||
result = num1 - num2;
|
||||
break;
|
||||
case '*':
|
||||
result = num1 * num2;
|
||||
break;
|
||||
case '/':
|
||||
result = num1 / num2;
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
int main() {
|
||||
double number = 0;
|
||||
double tmpNumber = 0;
|
||||
char input;
|
||||
char operator;
|
||||
while (1) {
|
||||
scanf(" %c", &input);
|
||||
switch (input) {
|
||||
case '+':
|
||||
operator = '+';
|
||||
tmpNumber = number;
|
||||
number = 0;
|
||||
break;
|
||||
case '-':
|
||||
operator = '-';
|
||||
tmpNumber = number;
|
||||
number = 0;
|
||||
break;
|
||||
case '*':
|
||||
operator = '*';
|
||||
tmpNumber = number;
|
||||
number = 0;
|
||||
break;
|
||||
case '/':
|
||||
operator = '/';
|
||||
tmpNumber = number;
|
||||
number = 0;
|
||||
break;
|
||||
case '=':
|
||||
printf("%lf\n", calculate(operator, tmpNumber, number));
|
||||
tmpNumber = 0;
|
||||
number = 0;
|
||||
break;
|
||||
case 'q':
|
||||
goto exit;
|
||||
// operator doesn't match any case constant
|
||||
default:
|
||||
number = (number * 10) + atof(&input);
|
||||
printf("%.1lf\n", number);
|
||||
}
|
||||
}
|
||||
exit:
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user