initializing vectors with variables, C++ -
I want to be able to start the vector using the variable like this:
int minimum max; Scanf ("% d% d", & amp; minute, & max); The vector & lt; Int & gt; Day (minimum, maximum, maximum); But when I try to get an error message I get:
IntelliSense: any example of the creator "std :: vector & lt; _Ty, _Alloc & Gt; :: vector _Ty = int, _Alloc = std :: allocator] "Logic types are logic types: match (int, int, int)
Is there any way to solve this problem? The way? I'm using Visual Studio 2013 if it counts thanks!
You need a list-start to specify the content of the vector, assuming your compiler Supported by:
vector & lt; Int & gt; Days {minutes, max, max}; Before C + + 11, it was more tedious:
vector & lt; Int & gt; day; Day.push_back (minimum); day.push_back (max); Day.push_back (max);
Comments
Post a Comment