![]() ![]() Getchar() //To capture the new line character. Printf("%s\n", Light) //validate user input To capture the SPACE or ENTER since they are taken as characters. I posted on the forums that Code::Blocks was not working, but no one could. Help, no one can solve my problem Problem. Try moving the project on the affected computer to a directory that contains neither of these in its path. If you want that to be able to happen, you could use getchar() Some parts of Code::Blocks or the back-end compiler may not support non ASCII characters (such as ) or possibly spaces. %s on the other hand takes the whole answer and thus the whole of it is printed out.Īnother problem could have been pressing the SPACE key or ENTER key after giving the answer. In your case, if the user had put YES for the first question, only Y would appear in the printf and not YES. Ti Settings > Compiler > Chn tab Toolchain Executables > TÃch Compilerâs Installation Directory. Kim tra: Bn ã ti CodeBlocks bng MinGW GNU C/C Compiler (và d, ). This is because %c will only accept one character and not a string like %s would. Không th biên dch bt k chng trình C/C sau khi cà i t CodeBlocks. I hope you understand why %s worked and not %c. ![]() If you are in Windows maybe your C compiler accepts the library having a problem with this code below. Number in scanf: Sometimes, we need to limit the number of digit in integer or float, number of character in string. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |