+ 1
Cin.get()
what happens if we use int in cin.get() and whats the diffrence from using it for char?
4 Réponses
+ 1
The people who coded that function designed it to be used for reading character array since it is the fundamental unit of data and it is efficient for memory. you can use atoi() function to convert an char array or string to integer easily.
signature is get(char [25], int)
if you use int instead of char. it will cause error i think.
+ 1
AssasinStudent I see 🤔 thanks a lot🙏🏼
0
AssasinStudent thank you! it doesn't cause error but it won't work with using enter to get out of program, do you know how can I solve it?
0
I really don't know. Usually pressing enter have to stop the program. I just tested it on my machine it gives error when i use int. It may be depend on compiler. Unfortunately people are not good at designin programming languages. Always there is a bug in somewhere and they are complex to write and learn.