vector<double> varname; |
|
PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code. It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/ Hint: You can edit your post, highlight your code and press the <> formatting button. You can use the preview button at the bottom to see how it looks. I found the second link to be the most help. |
double vector[8]; is a bit misleading. Are you wanting to create an array called vector or a "vector" of something. You could create a vector of "standard pair" being a "string" or "char" and a "double" or create a struct and store that in a vector or an array.std::vector<std::pair<std;:string, double>> varibleName; or std::vector<structName> varibleName;.std::string junk; or if it is a single lettter char junk{};. Then read the file as inFile >> junk >> vector[i]; and choose another name other than "vector" as this could be a problem or at least confusing. |
|
std::string junk;" just "char junk{};".while (inFile >> junk >> numbers[count]) the variable junk is just reading the first letter, but does nothing with it. It is just a way to get past the letter to get to what you need.