I have been learning CPP lately, and I came across this question: Consider the below program: #include &lt;iostream&gt; using namespace std; class Hall {  public:  double cost; }; int main() {  Hall hall;  hall.cost=10000.50;  cout&lt;&lt;hall.cost;  return 0; } What will be the output of above coding?   The answer to this question is 10000.5, however, I couldn't understand why is it so ? In my opinion, answer should be either 10000.500000 as double has precision upto  6 decimal digits or it should print 10000.50 as it is the value assigned to hall.cost. Please explain.
In my  I was printing a double using cout that got rounded when I wasn't expecting it.  How can I make cout print a double using full precision?
$1,000 is pronounced as "one thousand dollars". Reading from left to right, it seems like it would make more sense to write the value as: 1,000$. This way the pronunciation of the value follows the way it's written. Every other numerical value I can think of places the unit after the value:   1 kg 1 L 1 m, etc...   I'm not sure if this question fits in with the rest of the questions on this site. But I'd like to know why currencies are so different from other quantities. Not to mention the need to separate groups of three digits with commas. Ways to eliminate switch in code Convert all text from uppercase to lowercase and vice versa? My question is how can I convert all text from uppercase to lowercase and vice versa? That is to change the cases of all the letters. It has to be done with a sed replacement somehow. Earlier i was not specifying a custom log format, and the captured request headers were getting printed fine. I wanted to log the unique-id-header, but could not find any way of doing so. So i copy pasted the log-format mentioned on , and unique id started getting logged.  Unfortunately, now the captured request headers are not getting logged. The %hrl and %hsl are coming out as empty strings.  Very weird. Here is my config, plzz help :(  listen server   bind *:80   mode http    option  httplog   option  http-server-close   no option logasap   # disable early logging of HTTP requests so that total transfer time is logged   option  forwardfor   capture request  header    X-Forwarded-For      len 500    capture request  header    Host                 len 500    capture request  header    X-Request-UID        len 500    rspadd  X-Haproxy-Backend:\ server    # Generate the X-Haproxy-Unique-ID and log it to make it easy to track requests   log-format %Ci:%Cp\ [id=%ID]\ [%t]\ %f\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %st\ %B\ %cc\ %cs\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ {%hrl}\ {%hsl}\ %{+Q}r   unique-id-format %{+X}o\ %Ci:%Cp_%Fi:%Fp_%Ts_%rt:%pid   unique-id-header X-Haproxy-Unique-ID   Here is the log i see:  Sep 13 17:28:57 localhost haproxy[11979]: 10.161.27.218:41592  [id=0AA11BDA:A278_0AA15B71:0050_505217C5_0014:2ECB] [13/Sep/2012:17:28:37.567]  server www-example-com-healthz/- 19998/0/2/1/+20001 200 +326  - - ---- 10/10/1/1/0 0/0 {} {}  "GET /testing/healthz?merchant=www.example.com&amp;source=elb HTTP/1.1"   Note that %hrl and %hsl are empty strings :( How do i capture the request headers ?? NFL overtime: after a field goal, clock runs out on second team's possession Under the NFL's current "modified sudden death" overtime rules, if the first team scores a field goal, the second team is entitled to one more possession.  What happens if the clock runs out during that possession?  Suppose the score is tied 20-20 at the end of the 4th quarter. Team A wins the overtime coin toss and receives the kickoff to begin overtime.  After a long slow drive, Team A scores a field goal to make the score 23-20.  Now they kick off to Team B.  Team B is not able to score, and the overtime period ends with Team B still in possession.  What happens?   is not very explicit on this point.  Article 4 (a) says:     There shall be a maximum of one 15-minute period, even if the second team has not had an opportunity to possess the ball or if its initial possession has not ended. If the score is tied at the end of the period, the game shall result in a tie.   I think this means that Team A wins, 23-20, but I am not completely sure.  Has this ever happened in a regular-season NFL game? NSInvalidUnarchiveOperationException: Could not instantiate class named NSLayoutConstraint Why is 128==128 false but 127==127 is true when comparing Integer wrappers in Java? What may happen after a stack of spells resolves? Within the same phase, once a stack of spells has resolved in its entirety, is priority once again given to a player so that more spells may be cast?  For example:  I attack with a creature. Opponent opts not to block. Now, I want to buff (e.g. +3/+3) my creature multiple times, but I'm afraid of my opponent responding with a burn (e.g. Deal 3 damage) spell at the top of the stack. Can I buff once, ask if opponent wants to respond, then allow the stack to resolve. Then, in the same phase, cast more buff? Google Sheets QUERY won't display cell text if other cells have numbers I'm not sure what is happening in my Google Sheet query and could really use some help. I have  that demonstrates and explains the issue.   Basically, I'm using a query to pull data from a Google Spreadsheet that is populated by a Google Form. If the form submits only numbers (100), there is no problem. However, if someone submits a string ($100 or 100 dollars), the query will not display the string. It will only display form submissions that are 100% numbers.   Also, if the 1st submission is a string (not 100% numbers) the query will work.   Here is my query  =query(data!B2:CL,"select B, C, D, E, F, G, H, I, J, CI, BZ, CA, BA  where J = 'Industry Certification'",false)   Any ideas on why this is happening?  Also, I'm aware that I can limit the form to numbers only. I'm trying to avoid that and learn 'why' this is happening. A word for someone who you share a half-sibling with This is probably best explained with an example.  Alice and Bob have a child, Erin. Bob and Carol have a child, Frank. Carol and Dan have a child, Grace. Clearly, Erin and Frank are half-siblings, because of their father, Bob. Similarly, Grace and Frank share their mother, Carol.  Erin and Grace have no parents in common, and are thus not half-siblings. However, is there a term for their relation? Update 2014-04-17 04:47 UTC: Stable, with some odds and ends to clean up      The main MSO/MSE sites are stable, but there are plenty of corners left to sweep. For details, see:    Not all of them mind you, just Meta Stack Overflow into Meta Stack Exchange.  I'll have you know, factually, that we really did believe this would take place in six-to-eight weeks when it was , but we've finally got a tentative date established.  If things go according to plan, we'll begin the operation shortly after 8:30 PM EDT on the 16th, completing everything within a few hour window. Ideally, all service disrupting endeavors will be completed within the first hour, which include:   The availability of Meta Stack Overflow The availability of Stack Overflow (more on this shortly) The availability of Chat on Meta Stack Overflow   As you know, we'll be bolting on a standard issue per-site meta on Stack Overflow, while breaking the link between what will have become Meta Stack Exchange and Stack Overflow. There's some irritable innards in that particular region, so we'll be asking folks to expect the unexpected during the maintenance window. Affected sites will be in and out of read-only mode, or quite possibly just down for maintenance while we're doing the actual break.  I'll be posting a system message on both Meta Stack Overflow as well as Stack Overflow itself 24 hours before we begin the actual work.   Did I say tentative in a six-to-eight-something time frame again? Why yes, I did - we're currently running some tests on the dev tier to simulate the split as closely as possible, so that we can better anticipate quirks that we need to address prior to actually doing it.  Once the sites have actually been stood up functionally on the production tier, we're going to get to work on finishing touches. This will include things like site settings (which determine bits of text you see in the question prompts, rep thresholds, etc) and all sorts of other fine tuning.  Once we're done:   Stack Overflow will have a blank, empty child meta site just like every other site The new Meta Stack Exchange will be up and running All rooms on Chat Meta Stack Overflow will be moved to Chat Meta Stack Exchange  I'll send over about 150 - 200 questions from MSE to MSO, most of which will be tag or SO-specific feature related posts that got buried by the network stuff without resolution.   If the tentative date moves, I'll update this post with the new date. However, we do not anticipate this happening any later than Saturday, April 19 - in the case that we see down time we can't mitigate and need to do it on a weekend.  The ground work is basically done, we're finishing up sanity now with a great deal of confidence, and we're pretty certain that we'll hit between those dates, if not directly on the tentative 16th.  Questions? Kvetch? Anonymous confessions? Answer below, and I'll address each in comments. Let $A,B \subset \mathbb{R}$. Show that $\sup(A \cup B) = \max\{\sup A, \sup B\}$ Prove that $a^3+b^3+c^3 \geq a^2b+b^2c+c^2a$ Let $a,b,c$ be positive real numbers. Prove that $a^3+b^3+c^3\geq a^2b+b^2c+c^2a$.   My (strange) proof:  $$ \begin{align*} a^3+b^3+c^3 &amp;\geq a^2b+b^2c+c^2a\\ \sum\limits_{a,b,c} a^3 &amp;\geq \sum\limits_{a,b,c} a^2b\\ \sum\limits_{a,b,c} a^2 &amp;\geq \sum\limits_{a,b,c} ab\\ a^2+b^2+c^2 &amp;\geq ab+bc+ca\\ 2a^2+2b^2+2c^2-2ab-2bc-2ca &amp;\geq 0\\ \left( a-b \right)^2 + \left( b-c \right)^2 + \left( c-a \right)^2 &amp;\geq 0 \end{align*} $$  Which is obviously true.    However, this is not a valid proof, is it? Because I could just as well have divided by $a^2$ rather than $a$:  $$ \begin{align*} \sum\limits_{a,b,c} a^3 &amp;\geq \sum\limits_{a,b,c} a^2b\\ \sum\limits_{a,b,c} a &amp;\geq \sum\limits_{a,b,c} b\\ a+b+c &amp;\geq a+b+c \end{align*} $$  Which is true, but it would imply that equality always holds, which is obviously false. So why can't I just divide in a cycling sum?  Edit: Please don't help me with the original inequality, I'll figure it out. How to mount an ISO file? I'm running into trouble trying to mount a large iso:  dev@dev-OptiPlex-745:~$ sudo mount -o loop /home/dev/Hämtningar/matlab2011a_64.iso /cdrom mount: warning: /cdrom seems to be mounted read-only. dev@dev-OptiPlex-745:~$    Can you tell me how I should do it? How to stop reordering of the same kind multiple preview windows in task switching? Give $\ker(\phi)$  for $\phi: \mathbb{Z} \to \mathbb{Z_7}$ such that $\phi(1) = 4$  So the generator of $\mathbb{Z}$ maps to $4$ and $\langle 4 \rangle = \{0,1,2,3,4,5,6\}$ so it has order seven.  so $\ker(\phi) = 7\mathbb{Z}$ because every seventh element will map to the identity under the given map. Is that the correct reasoning? After removing any part the rest can be split evenly. Consequences? Let $S$ be a finite collection of real numbers (not necessarily distinct). If any element of $S$ is removed then the remaining real numbers can be divided into two collections with same size and same sum ; then is it true that all elements of $S$ are equal ?  (I know the result is true if the &quot;reals&quot; are replaced by &quot;integers&quot;.) Choosing the best model from among different "best" models How do you choose a model from among different models chosen by different methods (e.g. backwards or forwards selection)?  Also what is a parsimonious model? How can I repair a ceiling fan that hums, but doesn't turn? When does a flying creature start and end falling? Situation:  Alice the Aarakokra sees Bob the Battlemaster coming. She ascends to 605', just out of the 600' range of Bob's longbow.  Bob (Str 14) performs a running high jump 5' into the air and successfully hits Alice with his longbow, despite firing at disadvantage for long range. He spends one of his maneuver dice to perform the Trip Attack maneuver, and succeeds on the contested roll to knock Alice prone.  Alice is now flying and prone, so she falls. Falling does 1d6 bludgeoning damage per 10' fallen, to a maximum of 20d6.  Questions:   When does Alice start falling? It is on Bob's turn as soon as she's knocked prone, or some time else such as the beginning of her own next turn? When does Alice hit the ground? On Bob's turn as soon as she's knocked prone, or some time else?   These answers determine whether anyone can save Alice from her 20d6 of certain doom.   Is a reaction (e.g. casting Feather Fall) on Bob's turn the only hope? Can Alice's ally Charlie swoop in on his subsequent turn within the same round to catch her? Can Alice spend half her movement on her next turn to "stand from prone" and pull out of her involuntary dive? If Alice had expected to be shot down, could she have spent an action to be Ready to "stand from prone" while moving through Bob's airspace?