refresh
This commit is contained in:
parent
56b94675c7
commit
bc79879ba9
@ -4,7 +4,7 @@
|
||||
#define LINESIZE 100
|
||||
|
||||
struct pizza {
|
||||
float size;
|
||||
float prize;
|
||||
char name[LINESIZE];
|
||||
};
|
||||
|
||||
@ -71,6 +71,35 @@ int search_string (const char* heap_orig, const char* needle_orig) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int read_pizza (struct pizza* item) {
|
||||
char Line_jeden[LINESIZE]; //название пиццы
|
||||
char Line_druha[LINESIZE]; //цена
|
||||
|
||||
if (fgets(Line_jeden, sizeof(Line_jeden), stdin)==NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Line_jeden [strcspn(Line_jeden, "\n")] = '\0';
|
||||
|
||||
if (fgets(Line_druha, sizeof(Line_druha), stdin)==NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Line_druha [strcspn(Line_druha, "\n")] = '\0';
|
||||
|
||||
float value;
|
||||
if (sscanf(Line_jeden, "%f", &value ) !=1) {
|
||||
return 0;
|
||||
}
|
||||
item->prize = value;
|
||||
strcpy(item->name, Line_jeden);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main() {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user