0

Can anyone tell how really these functions work????

1.cin.ignore()
2.cin.clear()
3.cin.good()
4.cin.fail()
5.cin.bad()
6.cin.eof()

I mean to say what values these functions return at what situation...
thank you!

I also need to know about some user input validation techniques.i.e.
the user inputs valid data in the programs.....e.g.if there is some input
of date of birth the user enters only digits and in case of name the user
enters only characters etc.

Thank you once again....

4
Contributors
3
Replies
5
Views
8 Years
Discussion Span
Last Post by rudasi
0

Before inputing data you will be declaring the type of the data and so the compiler will give an error if you enter a different type eg,

int number;
cin>>number;

if you then enter an integer it will work but if you enter a character it wont similarily,

char initials;
cin>>initials; //the ">>" is an insertion operator

if you then enter a character it will work but not if you enter a number.
You always have to declare a variable before using it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.