When you read in roll_no on line 18, the newline is left in the buffer, so cin.getline() is probably reading that and thinking that you've entered just a newline (and thus, the empty string). You can use cin.ignore() to fix the problem.
[code]std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');[code]
This will ignore content in the stream up to and including the nextnewline.