43 lines
876 B
C
43 lines
876 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#define LIST_SIZE 100
|
|
#define LINE_SIZE 101
|
|
|
|
struct pizza {
|
|
char name[101];
|
|
float price;
|
|
};
|
|
|
|
int read_pizza_list(struct pizza* list) {
|
|
int counter = 0;
|
|
char line[200];
|
|
for (int i=0; i < LIST_SIZE; i++) {
|
|
struct pizza item;
|
|
memset(&item,0,sizeof(struct pizza));
|
|
if (fgets(line, sizeof(line), stdin)==NULL) {
|
|
break;
|
|
}
|
|
if (sscanf(line, "%[^\n]", item.name) !=1) {
|
|
break;
|
|
}
|
|
if (fgets(line, sizeof(line), stdin)==NULL) {
|
|
break;
|
|
}
|
|
if (sscanf(line, "%f", &item.price) !=1) {
|
|
break;
|
|
}
|
|
memcpy(&listok[i], &item,sizeof(struct pizza));
|
|
counter +=1;
|
|
}
|
|
return counter;
|
|
}
|
|
|
|
|
|
int compare (const void* a, const void* b) {
|
|
|
|
}
|
|
int main() {
|
|
|
|
return 0;
|
|
} |