• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Little problem

Core_

Well-Known Member
Joined
Jul 9, 2010
Messages
1,557
Solutions
1
Reaction score
50
Hey!, so I have this little problem that I have to fix really quick, its really simple and maybe someone can help me.

[Cpp]scanf("%d", &programs);
if (programs >= 6) {
printf(" there's only 5 programs in the options ");
}
else {
switch (programs){
case 1:
printf("Type the string\n");
getch();
gets_s(c);
[/Cpp]

Ok, the thing is the gets_s(c); doesn't ask me for the string (while running the program). So I just type the "1" for the first case and I get "Type the string" "The string has 0 numbers" "The String has 0 letters".

I need to actually type the string but it doesn't work, I know is really basic but I can't get it to work, and I'm pretty newbie at this.
the getch(); shouldn't be there but I just added it so it stops before asking for the string but it doesn't work either.
 
Hmm, the gets_s function described here takes a second parameter which is the size to get from standard input, can you post the rest of the code?

Here are some notes:
1. you're using getch() which gets a single char from stdin (which is 1)
2. are you breaking your switch after that?
 
Last edited:
Back
Top