Hi

Can anyone tell me what isdigit(cin.peek()) means? Is it the same as isdigit(next_char) where next_char is a character variable?

Thx...I'm just a beginner...

isdigit(cin.peek()) is basically the same thing as

char ch;
cin.get(ch);
isdigit(ch);
cin.unget();

It returns the next character on the stream and then tests to see if it's a valid numeric digit without removing the character from the stream.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.