1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Svetlanka [38]
3 years ago
11

_________function tells the cin object to skip one or more characters in the keyboard buffer.

Computers and Technology
1 answer:
Amanda [17]3 years ago
8 0

Answer:

cin.ignore function written as  cin.ignore()

Explanation:

  • As we know that cin is an object that is used to obtain the input entered by the user through the keyboard.
  • cin.ignore() is a function which is used to ignore or skip one or more characters in the keyboard buffer.
  • Keyboard buffer is a small storage area which is used to store keystrokes.
  • When a key is pressed on the keyboard it is referred to as a keystroke.
  • So before processing, these keystrokes are stored in keyboard buffer.
  • So when we use cin to input a character from the user through the keyboard, the keyboard buffer must be empty. If that's not done then the character entered will be taken by the buffer of previous variable.
  • Lets take an example of why we want to use cin.ignore() function.
  • For example you want the employee (user) to enter his name and you are using cin to read this name from the user.

                                          char empname[8];

                                           cin>>empname;

  • Now if the user types his name lets say Anonymous and press enter key this will be taken as new line character and it will store this newline character \n into the buffer.
  • cin >> statement reads data from the buffer and stops reading when it reaches newline character.
  • So Anonymous is read in and stored in empname variable but newline character is left in the keyboard buffer.                          
  • Lets say after cin>>empname we write another statement that takes a character from user. A user wants to enter character "a".

                                char character;

                            character = cin.get();

  • When cin.get finds the newline  character \n in keyboard buffer, it uses it (as cin.get can read the newline character in the buffer) without waiting for the  user to input "a".
  • So cin.ignore() function is used to avoid such situation.
  • We can specify the characters to be ignore within the cin.ignore() function such as cin.ignore(10,'\n') will ignore 10 characters in the buffer before taking new line or until a \n character comes.
  • You can simply use cin.ignore() which will ignore the very next character just as \n in our example. In our example we can use cin.ignore() after the cin>>empname; and before using cin.get();
You might be interested in
How many voltage values can be represented with a 10-bit binary code?
viktelen [127]
Answer is D. 1024
8 bits is enough to represent 256 different numbers. 9 bits is enough to represent 512 numbers. 10 bits can represent 1024 numbers.
8 0
2 years ago
Which statement best describes the problem statement below?
marta [7]

Answer:

B

Explanation:

This problem statement does not clearly define the issues.

7 0
3 years ago
A database is used instead of a spreadsheet when?
Luba_88 [7]
Lists involve date with multiple themes. 
5 0
3 years ago
How did The Gates by Christo and Jeanne-Claude affect the site?
Nadusha1986 [10]

Answer:

C. The experience of the park with The Gates was so different that some people saw the park in a new way.

Explanation:

The couple, Christo Javacheff and Jeanne-Claude Denat based in New York were two top contemporary artists who formed collaborative arts.

On the 3rd of January, 2005 they both made an art work known as The Gates, in Central Park.

The experience of the park with "The Gates" was so different that some people saw the park in a new way.

8 0
3 years ago
Read 2 more answers
Why computers are called "COMPUTER"?
Lady_Fox [76]

Because it ‘computes’ certain tasks, get it. It’s like saying ‘the puncher’ for someone who punches stuff.

8 0
3 years ago
Other questions:
  • A technology company only hires applicants who are under the age of 30. This company could face possibly _________ consequences
    9·2 answers
  • ___________ is an approach to boundary spanning that results from using sophisticated software to search through large amounts o
    8·1 answer
  • The term ____ describes primary storage devices that are implemented as microchips, can read and write with equal speed, and can
    8·1 answer
  • _____ should be used to create a project schedule.
    14·1 answer
  • In your own words, describe how a network administrator can use the OSI model to isolate a network problem.
    13·1 answer
  • Even if you cannot afford it you should donate at least 5 of your earnings to charity true or false
    8·1 answer
  • Converting Denary to Binary
    15·1 answer
  • List any three importance of computer points​
    8·1 answer
  • Lucas wants to expand his vocabulary to better understand the sentence below. The insidious burglar moved through the house unhe
    7·2 answers
  • Write a program that uses a structure to store the following data about a customer account: Name Address City, State, and ZIP Te
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!