We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
when using cin and getline for input, need to be careful, as cin does not read next line character, but the next getline function read tht character . So need to use getline twice. I tried cin.ignore before getline,but some problem was ther, may be u can give a try. before getline(cin,s1) add getline(cin,dummystring),
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 1: Data Types
You are viewing a single comment's thread. Return to all comments →
when using cin and getline for input, need to be careful, as cin does not read next line character, but the next getline function read tht character . So need to use getline twice. I tried cin.ignore before getline,but some problem was ther, may be u can give a try. before getline(cin,s1) add getline(cin,dummystring),