32 lines
588 B
C
32 lines
588 B
C
|
// Kostra tretieh cvicenia USAA 2019
|
||
|
#include <errno.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
|
||
|
#define LINE_SIZE 100
|
||
|
#define LIST_SIZE 100
|
||
|
|
||
|
|
||
|
struct pizza {
|
||
|
float prize;
|
||
|
char name[LINE_SIZE];
|
||
|
};
|
||
|
|
||
|
|
||
|
int main(){
|
||
|
// Vzor nacitania cisla s desatinnou ciarkou
|
||
|
// Vymazte ak Vam to netreba
|
||
|
char line[LINE_SIZE];
|
||
|
memset(line,0,LINE_SIZE);
|
||
|
printf("Zadaj cenu:\n");
|
||
|
char* r = fgets(line,LINE_SIZE,stdin);
|
||
|
if (r && r[1] != 0){
|
||
|
float prize = strtof(line,NULL);
|
||
|
if (prize != 0){
|
||
|
printf("cena je %.2f",prize);
|
||
|
}
|
||
|
}
|
||
|
return 0;
|
||
|
}
|