My code takes input(str of ints essentially)
input: 123 456 789 90
I'm trying to take each number such as 123
456
etc. and adding them into one element of my array but I'm not sure how to add the entire 123
.
some_int represents the number of ints. So in this case, it would be 4
int* arr_func(int some_int)
{
std::string str;
std::getline (std::cin, str);
int* p = new arr[some_int];
for (i=0;i<str.length(),++i)
{
if (str[i] != ' ')
{
arr[n] = str[i];
}
}
return p;
}
I know what my code does and it's incorrect, but that's all I have right now. I want my array to look something like this at the end when I return it.
[123] [456] [789] [90] each [] denoting an element/cell.
I know how to convert str to int, but the main focus is instead of just each cell/element being [1] [2] [3] [4] [5]
, how do I make it so it appears like above.
Thanks