How do you fix the unbounded string copy in the following code?
char fname[20]; /* 1 */ cout << “Enter First Name:”; /* 2 */ cin >> fname ; /* 3 */
Replace cin call in line 3 with gets() function.
The length of input from cin cannot be limited. Use a larger array for fname.
Use cin.width[20] before line 3.
Use cin.size[19] before line 3.