Question:
In C++ language, the instruction ‘ignore(x,y);’ ________.
C++ भाषा में, निर्देश ‘ignore(x,y);’ ________।
Options:
- skips the last x characters and stops if character y is encountered
- skips the first y characters and stops if character x is encountered
- skips the first x characters and stops if character y is encountered
- skips the last y characters and stops if character x is encountered
- अंतिम x वर्णों को छोड़ता है और यदि वर्ण y मिलता है तो रुक जाता है
- पहले y वर्णों को छोड़ता है और यदि वर्ण x मिलता है तो रुक जाता है
- पहले x वर्णों को छोड़ता है और यदि वर्ण y मिलता है तो रुक जाता है
- अंतिम y वर्णों को छोड़ता है और यदि वर्ण x मिलता है तो रुक जाता है
Correct Answer: c)
Explanation:
In C++, the stream member function `cin.ignore(int n, char delim)` extracts and discards up to `n` (here `x`) characters from the input buffer, stopping early if the specified delimiter character `delim` (here `y`) is encountered. Hence, it skips the first `x` characters and stops if character `y` is encountered.
C++ में `cin.ignore(x, y)` इनपुट बफर से पहले `x` वर्णों को निकालता और अनदेखा करता है, और यदि सीमांकक वर्ण `y` मिल जाता है तो वहीं रुक जाता है। अतः यह पहले x वर्णों को छोड़ता है और यदि वर्ण y मिलता है तो रुक जाता है।