InterviewSolution
Saved Bookmarks
| 1. |
Consider the following C++ statements1. char word[20]; cin>>word; cout<>word;2. char word[20]; gets(word); puts(word);If the string entered is “HAPPY NEW YEAR”. Predict the output in both cases and justify your answers. |
|
Answer» 1. HAPPY. When we use cin to accept string then space is the delimiter. The string after space is truncated. 2. HAPPY NEW YEAR. gets() reads all the characters (including space) upto the user presses the enter key. |
|