Topics
- cyclone and hurricanes
- C++ classes
Cyclones and Hurricanes
The first step was to simply count the number of types of storms in the data and print them out to the screen. I did this in a few lines of code, using a for loop.
The second part of the program was to print when there are multiple max wind types. I placed the printing section into a for loops and then compared the maxk value to print for each occurance of the at max number.
The third part of the program was to print a warning if there were winds from the cardinal directions in the data. I had to first change some of the numbers in the file and also check the values in the categories.
The forth part of the homework was to print out a grid of symbols corresponding to the right direction. I first filled a new array and then printed out that grid.
I was able to recast most of it but, for some reason, the grid wasn't entirely correct. I can't really figure out why.
C++ Classes
The first step was to just setup a class. I setup the class header file.
I also wrote a program to use this class.
I am doing something wrong because whenever I try to run the program I am redirected to the header file.
I keep changing the way I declare the array of strings. I can't call is a character array because these are more than one set of characters. It's more like an array of character arrays. I will have to work on this more tomorrow. I ended up having to make an array of strings which also meant I had to include the sting library.
I had a problem actually getting the array to work unless I individually added the elements as I wanted them to be. I did this by first declaring I wanted an array and then making a constructor to fill it.
I was still having this problem with my function so I added these prints to know which part was working. I know that constructor works.
The next thing I tried was to set the date. It wouldn't compile. Looking back at my function, I realize it doesn't make and sense. I was using cin to set the values but still feeding it arguments.
Even after I removed the variables it was still not working. What I wonder is if each object in a class has a variable unique to it.
I had a problem actually getting the array to work unless I individually added the elements as I wanted them to be. I did this by first declaring I wanted an array and then making a constructor to fill it.
I was still having this problem with my function so I added these prints to know which part was working. I know that constructor works.
The next thing I tried was to set the date. It wouldn't compile. Looking back at my function, I realize it doesn't make and sense. I was using cin to set the values but still feeding it arguments.
Even after I removed the variables it was still not working. What I wonder is if each object in a class has a variable unique to it.
