Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Fixing the mistakes that stopped the code from compiling (missing semicolons, uppercase M instead of lowercase m) I get the following:</p> <pre><code>#include &lt;iostream&gt; #include &lt;iomanip&gt; using namespace std; struct MovieData { string title; string director; unsigned year; unsigned running_time; double production_cost; double first_year_revenue; MovieData() // My default constructor { title = "Title"; director = "Director"; year = 2009; running_time = 90; production_cost = 1000000.00; // this one comes out ok. first_year_revenue = 1000000.00; // this one comes out ok as well. } // This is my constructor with arguments: MovieData(string t, string d, unsigned y, unsigned r, double p, double f) { title = t; director = d; year = y; running_time = r; production_cost = p; first_year_revenue = f; } }; void displayMovieData(MovieData m) { cout &lt;&lt; m.title &lt;&lt; endl; cout &lt;&lt; m.director &lt;&lt; endl; cout &lt;&lt; m.year &lt;&lt; endl; cout &lt;&lt; m.running_time; cout &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; setprecision(2); cout &lt;&lt; m.production_cost &lt;&lt; endl; cout &lt;&lt; m.first_year_revenue &lt;&lt; endl &lt;&lt; endl; } int main() { MovieData terminator( "Terminator", "James Cameron", 1984, 120, 5000000, 2000000); displayMovieData(terminator); return 0; } </code></pre> <p>Compiling and running it does <strong>not</strong> reproduce your problem...:</p> <pre><code>$ g++ -Wall --pedantic z.cc $ ./a.out Terminator James Cameron 1984 1205000000.00 2000000.00 $ </code></pre> <p>Please copy and paste the code exactly as I gave it here and let us know what happens (and with what compiler, platform, etc etc -- I'm using gcc 4.0.1 on MacOSX 10.5).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload