So im writing an encryption program for my class in school and i want to use the peek function to look for a space and if it is a space put the previous character back into the input stream.
ex) input="Whats going on."
after this process i would like for it to read
"Whatssgoinggon"
this is what i have but
1 2 3 4 5
for (int i=0; i < size; i++) {
if (cin.peek (array[i]) == ' ') {
array[i] = cin.putback (array[i]);
}
}
but i keep getting erroor that reads:
"no matching function to call std::basic_istream<char>:peek(char&)"
ive been stumped on this for a while and have been searching with no avail.