Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct {
- double X;
- double Y;
- double Z;
- }koord;
- int main()
- {
- int db = 0;
- koord akt;
- koord* tomb, * tmp;
- while (scanf_s("%lf,%lf,%lf", &akt.X, &akt.Y, &akt.Z) == 0)
- {
- db++;
- //Nyujtozkodo dinamikus tomb
- tmp = (koord*)malloc(sizeof(koord) * db);
- for (int i = 0; i < db; ++i)
- {
- tmp[i] = tomb[i];
- }
- free(tomb);
- tomb = tmp;
- //Idaig
- //Berakom a most beolvasott értéket
- tomb[db - 1] = akt;
- }
- //Itt már lesz egy coord nevű tömböd, aminek count db eleme van
- double max = tomb[1].Z - tomb[0].Z;
- int indmax;
- for (int j = 1; j < db; j++) {
- if (tomb[j].Z - tomb[j - 1].Z > max) {
- tomb[j].Z - tomb[j - 1].Z == max;
- indmax = j - 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement