+ 8
How can i keep taking input string from the user until there is no more data entered ?
I want to take an array of string from the user and end waiting when there is no more data entered. Without asking for the number of elements ? Any help please ?
7 Answers
+ 1
No Ahmed Mahmoud i make it as example but what language you use c or c++??
+ 5
HBhZ_C
check this question please
it wrote the function for that
but still stacking at how to take the query of the user ?
https://www.hackerrank.com/challenges/30-dictionaries-and-maps/problem
+ 4
but there is no pre-defined length of the array of string
and what user_input ?
is it a built in type defined data ?
+ 4
HBhZ_C
i use C
+ 2
Set a condition in while loop as like while(user_ input < string_length) .....
+ 2
Ahmed Mahmoud You have to read input from the user until he finished typing and return this input length in this example from stackoverflow.com how can i read an input string of unknown length he use realloc function.Check it and sorry i can not access hackerrank without account .
+ 2
Ahmed Mahmoud In c++ you have to declare map for phonebook and set for loop for name and number phone string user input .then check if key enteted by the user match phonebook name or not