Okay, I have a .csv file and have a bunch of code that is supposed to take the items and allow access to them when I need to. The problem is I get a build error saying "no suitable conversion function from "std::string" to "int" exists". So how do I get around this cause I need to access them by putting them into an array.
As for the error you experience on compilation (where it would be usual for you to provide the exact error message including line numbers), you cannot assign an arbitrary string to an int. You must first verify the string can be converted to a numerical value and do the conversion.
The other code on lines 25-33 were allow access to my struct as far as I know from my teacher.
Those lines do absolutely nothing but take up space.
I used stringstream as shown on line 49 so is there another step to this?
You are extracting strings from your stream. So, yes. There is another step to this. You need to obtain values of the correct type. You can do so either by extracting them directly or converting the strings you are currently obtaining from the stream via one of the methods previously linked to you.
It would be more idiomatic to initialize an istringstream (istringstream ss(weather);) rather than using a stringstream and performing both insertion and extraction operations on the stream.
The quick fix I used is to change weatherD[lineIndex].variable_name = weather;
to weatherD[lineIndex].variable_name = atoi(weather.c_str();
That at least got rid of the error messages.
I do not know which version of VS you are using, but in my 2015 version every place that weather had a problem it was underlined in red. Once I made the changes to use atoi() the errors disappeared.
Not knowing what is in the input file I could not test the program. I did notice on line 10 you create a struct Forecast then on line 38 you redefine Forecast as an ifstream. It did not cause a compile error or warning for me, but might be a problem at run time. Anyway ifstream is better used as something like inFile which better describes what it is.