a1
This commit is contained in:
parent
f1942a5351
commit
70e3f2cba3
53
a1/program.c
Normal file
53
a1/program.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(){
|
||||
|
||||
char pole[100];
|
||||
char* a = fgets(pole, 100, stdin);
|
||||
double cislo1;
|
||||
double cislo2;
|
||||
double vysledok;
|
||||
char znamienko;
|
||||
char* token;
|
||||
|
||||
token = strtok(pole, " "); //rozdelenie retazca podla medzier
|
||||
cislo1 = atoi(token); // premena stringu na cislo a priradenie cislu1
|
||||
token = strtok(NULL, " "); //pokracovanie v rozdelovani retazca
|
||||
znamienko = token[0]; // vrati ukazatel na nasledujuci token, cize znamienko
|
||||
token = strtok(NULL, " =\n");
|
||||
cislo2 = atoi(token);
|
||||
token = strtok(NULL, " =\n");
|
||||
vysledok = atoi(token);
|
||||
|
||||
double realny;
|
||||
|
||||
switch (znamienko){
|
||||
case '+':
|
||||
realny = cislo1 + cislo2;
|
||||
break;
|
||||
case '-':
|
||||
realny = cislo1 - cislo2;
|
||||
break;
|
||||
case '*':
|
||||
realny = cislo1 * cislo2;
|
||||
break;
|
||||
case '/':
|
||||
realny =cislo1 / cislo2;
|
||||
break;
|
||||
default:
|
||||
printf("CHYBA\n");
|
||||
return 1;
|
||||
}
|
||||
if (realny == vysledok){
|
||||
printf ("OK\n");
|
||||
}
|
||||
else{
|
||||
printf ("ZLE\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
a1/program.exe
Normal file
BIN
a1/program.exe
Normal file
Binary file not shown.
33
a1/program.exe.stackdump
Normal file
33
a1/program.exe.stackdump
Normal file
@ -0,0 +1,33 @@
|
||||
Exception: STATUS_ACCESS_VIOLATION at rip=7FFF82234123
|
||||
rax=00007FFF822B57E0 rbx=0000000000000000 rcx=00000007FFFFCE00
|
||||
rdx=0000000000000000 rsi=000000000000000A rdi=0000000000000000
|
||||
r8 =0000000000000000 r9 =000000000000000A r10=00000007FFFFCE00
|
||||
r11=000000000000002A r12=00000007FFFFCE00 r13=0000000000000000
|
||||
r14=0000000000000000 r15=00007FFF822B57E0
|
||||
rbp=0000000000000000 rsp=00000007FFFFCAA0
|
||||
program=C:\cygwin64\home\matus\a1\program.exe, pid 2084, thread main
|
||||
cs=0033 ds=002B es=002B fs=0053 gs=002B ss=002B
|
||||
Stack trace:
|
||||
Frame Function Args
|
||||
000000000000 7FFF82234123 (000000000000, 0007FFFFCC40, 000100000370, 7FFF822B57E0) cygwin1.dll+0x174123
|
||||
0007FFFFCC40 7FFF82234411 (000A00000370, 0007FFFFCDF0, 000000000000, 000800021389) cygwin1.dll+0x174411
|
||||
0007FFFFCC40 7FFF82230591 (7FFF8239F0C0, 7FFF822B5800, 7FFF8239F160, A623D312A0061) cygwin1.dll+0x170591
|
||||
0007FFFFCC40 00010040112D (000000000000, 000000000000, 000000000000, 000000000000) program.exe+0x112D
|
||||
0007FFFFCD30 7FFF820C80A3 (000000000000, 000000000000, 000000000000, 000000000000) cygwin1.dll+0x80A3
|
||||
0007FFFFFFF0 7FFF820C5C86 (000000000000, 000000000000, 000000000000, 000000000000) cygwin1.dll+0x5C86
|
||||
0007FFFFFFF0 7FFF820C5D34 (000000000000, 000000000000, 000000000000, 000000000000) cygwin1.dll+0x5D34
|
||||
End of stack trace
|
||||
Loaded modules:
|
||||
000100400000 program.exe
|
||||
7FF812C10000 ntdll.dll
|
||||
7FF804620000 aswhook.dll
|
||||
7FF810960000 KERNEL32.DLL
|
||||
7FF80FF50000 KERNELBASE.dll
|
||||
7FFF820C0000 cygwin1.dll
|
||||
7FF8113F0000 advapi32.dll
|
||||
7FF811050000 msvcrt.dll
|
||||
7FF8112B0000 sechost.dll
|
||||
7FF810300000 bcrypt.dll
|
||||
7FF810A40000 RPCRT4.dll
|
||||
7FF80F6B0000 CRYPTBASE.DLL
|
||||
7FF810720000 bcryptPrimitives.dll
|
Loading…
Reference in New Issue
Block a user