Displaying long cout chains – CSKC
Sign In

Search

Solved Problem #CPP#3060    siteicon   siteicon  

Problem Statement - Displaying long cout chains

Write a C++ code to display the following text using the same cout chain.
Apples = 5 Kg
Bananas = 2 Doz
Oranges = 2.5 Kg

 

 

Solution

TC++ #3060

 

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

cout<<“Apples = 5 Kg “<<endl
<<“Bananas = 2 Doz “<<endl
<< “Oranges = 2.5 Kg “<<endl;
endl can be used in between multiple portions of the cout chain to change the line.

Notes

  • One can alternative write following code with three cout statements, but 1 cout chain can make it more efficient.
    cout<<“Apples = 5 Kg “<<endl;
    cout<<“Bananas = 2 Doz “<<endl;
    cout<< “Oranges = 2.5 Kg “<<endl;


Share

Created: 26-Jan-2018 20:03 | Updated: 14-Dec-2018 00:24|