Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- struct movie {
- char title[100];
- char dname[100];
- char nf[100];
- char nm[100];
- int date;
- int price;
- };
- int main()
- {
- struct movie mv[200];
- float max = mv[0].price, tot=0;
- int maxi = 0, n=3, count = 0;
- for (int i = 0; i < n;i++){
- gets(mv[i].title);
- gets(mv[i].dname);
- gets(mv[i].nf);
- gets(mv[i].nm);
- scanf("%d", &mv[i].date);
- scanf("%d", &mv[i].price);
- }
- for (int i = 0;i<n;i++) {
- if (mv[i].price > max){
- max = mv[i].price;
- maxi = i;
- }
- if (strcpy(mv[i].nf, "Meg Ryan") == 0) {
- tot += mv[i].price;
- count++;
- }
- }
- float avg = tot/count;
- printf("%s %f", mv[maxi].dname, avg);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement