Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdbool.h>
- #include <math.h>
- #include "train.h"
- #define LEN 10
- struct Train train_max(Train * a[]) {
- //int q = sizeof(a) / sizeof(Train);
- int b[LEN], max = -1;
- for (int i = 0; i < LEN; i++) {
- b[i] = 0;
- }
- for (int i = 0; i < LEN; i++) {
- if (a[i]->num != -1) {
- int p = a[i]->num;
- for (int j = 0; j < LEN; j++) {
- if (a[j]->num == p) {
- b[i]++;
- a[j]->num = -1;
- }
- }
- if (b[i] > max) {
- max = b[i];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement