To read both sets of data from the file, learn how two dynamic arrays are created in C: each one allocated 100 elements at a time. One dynamic array stores the timestamp as a time_t (Epoch) value, the other stores barometric pressure. The dates are read by using a less-than-equal string comparison so that they'll be inclusive if not exact. The linear regression formula returns the coefficient of the slope. A chart graphs the data, presenting the result line-by-line in text mode output.
- [Instructor] For my solution…I knew that the first step…is to read the date range…and then validate the input.…The main function prompts for the date range…and uses the scanf function to read the values.…I toyed with the idea of adding seconds…or removing minutes…or changing the date format to two digit,…because I type that often during testing,…but I left it as four digits,…and kept the minutes, but not the seconds.…Next, the check input function is called…to validate the date's input.…
It uses a lot of if statements…to check specific ranges…and every possibility…to ensure that items aren't entered…out of sequence.…When a value is out of range or sequence…the program stops.…I can do further checking, for example,…to ensure that February's date range…is from one to 28 or 29 on a leap year,…but that type of invalid data…is caught when the program runs…and fails to generate output.…After input is checked,…the read data function scans through the files…for a matching start date.…
The file names are hardcoded…and assumed to be in the same folder…
Skill Level Intermediate
1. Summarize the Weather
2. Geolocation with C
3. Eight Queens with C
4. Build a Musical Instrument with C
5. Face Recognition with C
6. Web Dashboards with C
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.