Message from C, C++ discussions

December 2019

— What do you mean with "+2"? Is it a positive integer? A string? Is your output a string that you need to convert to an int?

Message permanent page

— 

"+2" as if it was a word like "house". Well actually I want to assign "+2" to a position of a vector whose elements are integers

— So you want to save the number 2

— No, i want to save "+2" which is not an integer, there comes the problem

— In a vector of integers?

— Yup

— You can't

— It's called vector of ints for a reason 🤔

— Even with strings?

— Create a vector of strings if you need that

— How?

— std::vector<string> vectorOfStrings;