I'm taking an online C++ class, and if any of you have had experience with that, you know it's difficult. I can never see the instructor in person, and he's terrible at communicating the lesson online. I really need some help on this chapter 6 quiz, the first question just completely duped me.
"Assume that appropriate header files have been included. In addition, assume fixed, showpoint and setprecision(2) have been sent to the standard output stream via the stream insertion operator. Finally, assume expression ceil(abs(-8 - floor(-5.5))) is sent to the standard output stream via the stream insertion operator.
What is displayed on the standard output device?"
the instructor is asking you to write a small program for the question, then run the program to get the result. So what you need to do is:
- find out header names for fixed, showpoint, setprecision, ceil, abs, floor, then include the headers in your program
- shoot fixed, showpoint, setprecision and ceil(abs(-8 - floor(-5.5))) to cout to get result displayed on your screen.
I think it's because I did not understand chapter 6 in our book (which has to do with all of those things you talked about), but could you be more specific? Like how I;
-find out the header names?
-and shoot them to cout?
to find out the header names, search this website for each function the question talks about "fixed, showpoint and setprecision(2)" to name a few. When he says "shoot them out to cout" he's talking about printing to the console (standard output) or w/e you want to call it.
"Assume that appropriate header files have been included.
You don't need to worry about the headers as they're already included...
In addition, assume fixed, showpoint and setprecision(2) have been sent to the standard output stream via the stream insertion operator.
Do you know what effect these have on the output stream?
Finally, assume expression ceil(abs(-8 - floor(-5.5))) is sent to the standard output stream via the stream insertion operator.
Do you know what this expression evaluates to?
What is displayed on the standard output device?"
If your answer was yes to the above 2 questions then you should know the answer to this question. Otherwise you might want to go back and re-examine those functions. He's not asking you to write any code, just to determine what the output would be in the example.
I agree that the teacher is not asking you to write any code, but I believe Eric Du's point was that by writing the code you might gain a better understanding of what the teacher is asking. I'm sure you could find the answer by reading the book, but what good is that if you don't understand it's use?