Each strike or multiple strikes on the keyboard represents a character: a letter, a digit, or a symbol. However, some characters are not labeled on the keyboard and
some of them are not printable. Each character is represented by a numeric code that was agreed upon and standardized by a committee and this is known as
ASCII code. Characters are the building blocks of any data in a computer, whether they are integers, doubles, or strings. In fact, one of the first jobs of a system
programmer is to convert a sequence of characters to its intended meaning. For example, 1, 2, and 3 (one, two, three) becomes 123 (one hundred twenty three).
Similarly, a sequence of characters represents a word,
several words form a sentence, and a combination of sentences generates a
story.
White space is considered a space, a tab, a vertical tab, or a new line. When receiving input using cin (an object of istream, which is also known as console input), the leading white space to an input is ignored. In several situations, ignoring white space is useful, but there are cases where white space is part of the data, such as a street address, where we do not want to break the address into separate units. One solution is to replace the white space with punctuation such as a dot (.) as demonstrated by the program below. Additional characters to replace blank spaces can be cumbersome; you may argue that this is not a desirable solution and wish to know an alternative.
#include<iostream.h> void main(){ char streetaddress[50]; cout<<"ENTER STREET ADDRESS: "; cin>>streetaddress; cout<<"STREET ADDRESS IS:
"<<streetaddress<<endl; }//MAIN