Hi i want to save several names to an array and the user will decide how many names and it has one condition, the names can not be more than 20 characters.
Can someone please help me???? I can save the names but i can't think of anything to apply that condition.
Assuming you are using std::string, you can simply check the length of the string by invoking the length() method exactly what Thomas suggested. If you're using C-style string, loop through the array of characters one character at a time until '\0' is reached while increasing a counter variable by one after every loop iteration and checking to see if the counter is >= 20, if so then reject the name.