You are making it much harder than it needs to be.
The intent of the for loop seems to be to look at each character in the string individually. That's good.
But then the body of the loop does the exact same thing every time through. Line 9 finds the first occurrence of " " in line (the first occurrence of course never changes, so it always returns the same thing). Etc.
Hint: line[ loopBlank ] returns the (loopBlank)th character in the string. All you want to do is see if this character is a space ' '.
i did make it less complicated and it did click about what you said with the loopBlank i got it to count the first space e.g
1 1
1 2
1 3
would return 3 spaces but if i did e.g
1 2 3 4
it would only return once space would i need a loop in there to get it to keep counting?
think its getting too late in the night for this lol
You could also use std::count_if and develop a predicate function that counts characters that aren't spaces. I read somewhere that it is better to not write your own loops if there is an existing algorithm that can do the work.