0

Hi anybody
do you know how to limit string that we input in the program ?
LIKE THIS:
Input Name: <-we can input only 5 characters

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by jonsca
0

Do you want the user to be able to type 5 characters and no more, or is it a case where you can just take the first 5 off of what they type?

0

You need to define what exactly you mean by limit. For example what should happen in the sixth character? Should the program just go with the first five character or should the program output an error message if more that 5 character is entered or should the program enable the user to input only 5 letters and any extra characters entered is ignored and not read as input? Not all of these choices can be done with pure C++.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.