
44 Input and Output in C++
Explanation: In the above program, the variables of int float, double, and char type are
declared and initialized. The variable a is initialized with 66, f with 2.5, d with 85.22, and c
with character ‘K’.
Explanation: Explanation of the program is as follows.
(a) cout<<“\n Enter integer, float, and char” – Prompts message “Enter integer, float,
and char”
(b) cin>>x>>y>>z – Accepts integer, float, and char and stores in x, y, and z.
(c) cout<<“\n Enter a string: ” – Displays message “Enter a string: ”.
(d) cin>>city – Reads string through the keyboard and stores in the array city[15].
(e) cout<<“City = ”<<city; – Displays ...