Grade 10 · 5 algorithmsCitește în română
The struct typeTipul struct
Every the struct type algorithm from the Romanian high school curriculum, with the idea explained, its complexity, examples and code you can edit and run right here.
- 5algorithms
- 6chapters
- 1grade
5 algorithms
0%
The struct type
Tipul struct · 5 algorithms
- Comparing calendar datesCompararea datelor calendaristiceA calendar date has three fields: day, month, year. Two dates are compared first by year, with equal years by month, and with equal months by day;…
- Adding durations (hours, minutes, seconds)Adunarea duratelor (ore, minute, secunde)A duration is kept in a structure with three fields. To add easily, we turn the duration into seconds (h * 3600 + m * 60 + s), add the numbers and…
- Students sorted by average and nameElevi sortați după medie și numeThe struct type groups data of different types under a single name: struct Elev { char nume[31]; double medie; }. A field is accessed with a dot…
- Operations with fractionsOperații cu fracțiiA fraction has two fields, the numerator a and the denominator b, so we represent it with struct Fractie { long long a, b; }. A function can return…
- Points in the planePuncte în planA point has the coordinates x and y: struct Punct { int x, y; }. The distance between two points is sqrt((x1 - x2)^2 + (y1 - y2)^2). For comparisons…