New course! Every coder should learn Generative AI!
Try a free lesson0
multiple insertion is used when you want to display the result of some function or value of some variable along with a constant string.
for example
void main()
{
int a = 10;
cout << "hello world!"; // single insertion
cout << "\nvalue of a is: " << a;
// multiple insertion
return;
}
output
hello world
value of a is: 10
"hello world" and "value of a is: " are constant strings while the value of a, which is a variable, can vary throughout the program, therefore to display the value of a at any given point, you will.need to use multiple insertion to display a string along with the variable
HAPPY PROGRAMMING!