Advertisement
CD503

storms.cpp

Nov 29th, 2024
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cstring>
  4.  
  5. //#include "STORMS_H"
  6. #include "storms.h"
  7.  
  8. using namespace std;
  9.  
  10. // int MAX_STORMS = 26;
  11. STORM Storm[] = {};
  12.  
  13. // int index = 0;
  14. void printStorm(){
  15. int count = 0;
  16. for (int i = 0; i < count +1; i++){
  17. cout << Storm[i].NAME << " " << Storm[i].STORM_YEAR << " " << Storm
  18. [i].STORM_MONTH << " " << Storm[i].STORM_DAY << " " << Storm[i].TYPE << " " <<
  19. Storm[i].STORM_CAT << " " << Storm[i].MAX_SPEED;
  20. }
  21. }
  22. STORM fillStormList(struct STORM Storm[], ifstream &infile){
  23. for (int i = 1; i <= 26 ; i++){
  24. infile >> Storm[i].NAME;
  25. infile >> Storm[i].STORM_MONTH;
  26. infile >> Storm[i].STORM_YEAR;
  27. infile >> Storm[i].STORM_DAY;
  28. infile >> Storm[i].TYPE;
  29. infile >> Storm[i].STORM_CAT;
  30. infile >> Storm[i].MAX_SPEED;
  31. // getStormName(inFile, Storm.NAME);
  32. // getStormYear(inFile, Storm.STORM_YEAR);
  33. // getStormMonth(inFile, Storm.STORM_MONTH);
  34. // getStormDay(inFile, Storm.STORM_DAY);
  35. // getStormType(inFile, Storm.TYPE);
  36. // getStormCat(inFile, Storm.STORM_CAT);
  37. // getStormMaxSpeed(inFile, Storm.MAX_SPEED);
  38. }
  39. return *Storm;
  40. }
  41. void initStorm(char NAME[], int STORM_YEAR, int STORM_MONTH, int STORM_DAY,
  42. char TYPE[], int STORM_CAT, int MAX_SPEED) {
  43. strcpy(Storm[0].NAME, NAME);
  44. cin.ignore(100, ' ');
  45. Storm[0].STORM_YEAR = STORM_YEAR;
  46. Storm[0].STORM_MONTH = STORM_MONTH;
  47. Storm[0].STORM_DAY = STORM_DAY;
  48. strcpy(Storm[0].TYPE, TYPE);
  49. cin.ignore(100, ' ');
  50. Storm[0].STORM_CAT = STORM_CAT;
  51. cin.ignore(100, ' ');
  52. Storm[0].MAX_SPEED = MAX_SPEED;
  53. }
  54. void getStormName(ifstream &infile, char NAME[]){
  55. infile.getline(NAME, MAX_CHAR);
  56.  
  57. }
  58. void getStormYear(ifstream &infile, int STORM_YEAR){
  59. infile >> STORM_YEAR;
  60.  
  61. }
  62. void getStormMonth(ifstream &infile, int STORM_MONTH){
  63. infile >> STORM_MONTH;
  64.  
  65. }
  66. void getStormDay(ifstream &infile, int STORM_DAY){
  67. infile >> STORM_DAY;
  68. }
  69.  
  70. void getStormType(ifstream &infile, char TYPE[]) {
  71. infile.getline(TYPE, 20);
  72. }
  73.  
  74. void getStormCat(ifstream &infile, int STORM_CAT){
  75. infile >> STORM_CAT;
  76.  
  77. }
  78. void getStormMaxSpeed(ifstream &infile, int MAX_SPEED){
  79. infile >> MAX_SPEED;
  80.  
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement