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]
4 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]4 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
The central computer on a network is called the ______. A) boss B) client C) parent D) server
KiRa [710]

Answer: The central computer on a network is called :

A Server.

Explanation: Server is a program that provides services to other programs or devices either on the same computer or over a computer network.

5 0
4 years ago
Read 2 more answers
Which button could Pamela press in the Microsoft Word spell checker to make the word “colour” instantly change to “color” whenev
dmitriy555 [2]
One step is to right click on the word to add it to her personal dictionary. or, <span><span>Press F7. Word starts the spelling and grammar checking utility. </span><span>Make corrections, as appropriate, when prompted.
</span></span>

However, one can create a macro that would do the conversions :

1) Identify a list of words whose spelling you want to convert.2) Turn on the macro recorder. 3) Use the Replace feature to replace the spellings.4) Turn off the macro recorder.

The macro will do a conversion from one to the other. Later, as we have more words that need to be automatically replaced, we can just edit the macro and add those words.

4 0
4 years ago
Difference between volatile and non volatile memory
slega [8]
<span>Volatile memory requires electricity or some kind of current to store information, and nonvolatile memory does not.</span>
6 0
3 years ago
Read 2 more answers
What is an activity that can help you enhance the appearance of your computer's desktop?
pishuonlain [190]
Depends? Maybe you can change the background of your computer?
3 0
3 years ago
Read 2 more answers
Assuming you have a TCF free student checking account, how many maximum overdraft fees can you incur in one day?
kodGreya [7K]

Answer:

8

Explanation:

7 0
3 years ago
Other questions:
  • If the object instance is created in a user program, then the object instance can access both the public and private members of
    9·1 answer
  • Microsoft windows server and linux are examples? of:
    12·1 answer
  • How to Ctrl + shift + F4 but in a HP laptop?​
    8·2 answers
  • ____ assigns a risk rating or score to each information asset. Although this number does not mean anything in absolute terms, it
    8·1 answer
  • Anyone else getting 502 bad gateway on here?
    7·1 answer
  • Write a for loop that sets each array element in bonusScores to the sum of itself and the next element, except for the last elem
    11·2 answers
  • The tremendous diversity ofthe source system is the primary reason for their complexity. Doyou agree/ If so, explain briefly why
    11·1 answer
  • What role do computer play in law and order​
    6·1 answer
  • Which of the following allows computers to communicate with each other? RAM NIC Hard drive Floppy disk
    11·1 answer
  • Rudy accidentally sent a sensitive work report to a personal friend named James instead one of his co-workers, who is also named
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!