Question

When creating a C++ program, a programmer can add as many cout objects as he wants...

When creating a C++ program, a programmer can add as many cout objects as he wants and get the output as he wants it to be,, true or false? Why?

1-Post your Primary Post to the discussion.

2-Review your classmates' Primary Posts.

3-Thoughtfully respond to a minimum of two classmates with 50 word Secondary Posts each.

4- Be sure to cite all sources (if used).

Homework Answers

Answer #1

Ans.True.

  • The standard output by default is the screen,and the C++ stream object defined to access it is cout.
  • For formatted output operations,cout is used together with the insertion operator,which is written as << (ie.two less than signs).
  • eg:cout<< 120 //prints number 120 on screen
  • eg:cout<< "Output" //prints the string Output on screen.
  • eg:cout<< x //prints the value of x on screen
  • The << operator inserts dat that follows it into the stream that precedes it.
  • Multiple insertion operations (<<) can be chained in a single statement.
  • eg:cout<<"This" << "is a" << ""C++ program".
  • The output will be: This is a C++ program.
  • To insert a line break,a new-line character can be inserted at the exact position the line that must be broken.This can be be done by using \n or end1 manipulator.
  • eg:cout<<"First"<<end1;
  • cout<<"Second"<<end1;
  • Output:First
  • Second
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Strings The example program below, with a few notes following, shows how strings work in C++....
Strings The example program below, with a few notes following, shows how strings work in C++. Example 1: #include <iostream> using namespace std; int main() { string s="eggplant"; string t="okra"; cout<<s[2]<<endl; cout<< s.length()<<endl; ​//prints 8 cout<<s.substr(1,4)<<endl; ​//prints ggpl...kind of like a slice, but the second num is the length of the piece cout<<s+t<<endl; //concatenates: prints eggplantokra cout<<s+"a"<<endl; cout<<s.append("a")<<endl; ​//prints eggplanta: see Note 1 below //cout<<s.append(t[1])<<endl; ​//an error; see Note 1 cout<<s.append(t.substr(1,1))<<endl; ​//prints eggplantak; see Note 1 cout<<s.find("gg")<<endl; if (s.find("gg")!=-1) cout<<"found...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...