Program won't run "cout" after the second function

1
Last edited on
Please use code tags when posting code. They look like <> on the right of the text box

Your code outputting fine to me:
Please enter a SINGLE Character to act as key:
e
Please enter a phrase or sentence >= 4 characters:
hello
0
I'm a function.
Notice the 0. It is here because you first replacing character with '-' and then trying to count already replaced character.
yes, but it's supposed to show the three functions after entering both the keyCharacter and str.
yes, but it's supposed to show the three functions after entering both the keyCharacter and str.
1
2
3
4
5
6
7
8
9
10
11
int main()
{
   string keyCharacter, str;
   int count=0;
   keyCharacter = getKeyCharacter(); //First line of output and line of input
   str = getString(); //Second line of output and line of input
   str = maskLetter(str, keyCharacter); //No putput
   count = countKey(str, keyCharacter); //One number
   cout << "I'm a function. \n"; //One line
   return 0;
}
Everything you call is outputted.
1
Last edited on
i am a ranger
it reads i, then as it is les than 4 characters it prompts to enter again, reads am, prompts again, reads a, repeat, reads ranger which finally suits conditioins.
Operator >> reads space delimited values. That means it stops readin after it encounter space. If you need whole line, use std::getline()
thank you minipaa, getline works, but "Please enter a phrase or sentence >= 4 characters: \n" is still repeating. how could i modify my loop to let in only show once whatever i enter.
but "Please enter a phrase or sentence >= 4 characters: \n" is still repeating
You made a mistake somewhere. Show what you did.
i got it, ty very much.
Topic archived. No new replies allowed.