title: fatal error C1075: end of file found before the left brace and read and write files not working
body: <p>could someone also tell me if the actions i am attempting to do which are stated in the comments are correct or not. i am new at c++ and i think its correct but i have doubts</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;fstream&gt;
  #include&lt;cstdlib&gt;
  #include&lt;iomanip&gt;
  using namespace std;
  int main()
  {
   ifstream in_stream; // reads itemlist.txt
   ofstream out_stream1; // writes in items.txt
      ifstream in_stream2; // reads pricelist.txt
   ofstream out_stream3;// writes in plist.txt
   ifstream in_stream4;// read recipt.txt
   ofstream out_stream5;// write display.txt
   float price='  ',curr_total=0.0;
   int wrong=0;
   int itemnum='  ';
   char next;
   in_stream.open("ITEMLIST.txt", ios::in); // list of avaliable items
     if( in_stream.fail() )// check to see if itemlist.txt is open
     {
         wrong++;
        cout &lt;&lt; " the error occured here0, you have " &lt;&lt; wrong++ &lt;&lt; " errors"  &lt;&lt; endl;
        cout &lt;&lt; "Error opening the file\n" &lt;&lt; endl;
        exit(1);
        }
     else{
      cout &lt;&lt; " System ran correctly " &lt;&lt; endl;
  
   out_stream1.open("listWititems.txt", ios::out); // list of avaliable items
     if(out_stream1.fail() )// check to see if itemlist.txt is open
     {
         wrong++;
        cout &lt;&lt; " the error occured here1, you have " &lt;&lt; wrong++ &lt;&lt; " errors"  &lt;&lt; endl;
        cout &lt;&lt; "Error opening the file\n";
        exit(1);
        }
     else{
      cout &lt;&lt; " System ran correctly " &lt;&lt; endl;
     }
  
   in_stream2.open("PRICELIST.txt", ios::in);    
    if( in_stream2.fail() )
     {
         wrong++;
        cout &lt;&lt; " the error occured here2, you have " &lt;&lt; wrong++ &lt;&lt; " errors"  &lt;&lt; endl;
        cout &lt;&lt; "Error opening the file\n";
        exit (1);
     }
     else{
      cout &lt;&lt; " System ran correctly " &lt;&lt; endl;
     }
  
   out_stream3.open("listWitdollars.txt", ios::out);    
    if(out_stream3.fail() )
     {
        wrong++;
        cout &lt;&lt; " the error occured here3, you have " &lt;&lt; wrong++ &lt;&lt; " errors"  &lt;&lt; endl;
        cout &lt;&lt; "Error opening the file\n";
        exit (1);
     }
     else{
      cout &lt;&lt; " System ran correctly " &lt;&lt; endl;
     }
  
   in_stream4.open("display.txt", ios::in);
    if( in_stream4.fail() )
     {
         wrong++;
        cout &lt;&lt; " the error occured here4, you have " &lt;&lt; wrong++ &lt;&lt; " errors"  &lt;&lt; endl;
        cout &lt;&lt; "Error opening the file\n";
        exit (1);
     }
     else{
      cout &lt;&lt; " System ran correctly " &lt;&lt; endl;
     }
  
  
   out_stream5.open("showitems.txt", ios::out);
     if( out_stream5.fail() )
     {
         wrong++;
        cout &lt;&lt; " the error occured here5, you have " &lt;&lt; wrong++ &lt;&lt; " errors"  &lt;&lt; endl;
        cout &lt;&lt; "Error opening the file\n";
        exit (1);
     }
     else{
      cout &lt;&lt; " System ran correctly " &lt;&lt; endl;
     }
      in_stream.close(); // closing files.
    out_stream1.close();
    in_stream2.close();
    out_stream3.close();
    in_stream4.close();
    out_stream5.close();
    system("pause");
   in_stream.setf(ios::fixed);
   while(in_stream.eof())
   {
    in_stream &gt;&gt; itemnum;
    cin.clear();
    cin &gt;&gt; next;
   }
   out_stream1.setf(ios::fixed);
   while (out_stream1.eof())
   {
    out_stream1 &lt;&lt; itemnum;
    cin.clear();
    cin &gt;&gt; next;
   }
   in_stream2.setf(ios::fixed);
   in_stream2.setf(ios::showpoint);
   in_stream2.precision(2);
      while((price== (price*1.00)) &amp;&amp; (itemnum == (itemnum*1)))
     {
      while (in_stream2 &gt;&gt; itemnum &gt;&gt; price) // gets itemnum and price
      {
       while (in_stream2.eof())  // reads file to end of file
       {
       in_stream2 &gt;&gt; itemnum;
      in_stream2 &gt;&gt; price;
      price++;
      curr_total= price++;
      in_stream2 &gt;&gt; curr_total;
      cin.clear();  // allows more reading
      cin &gt;&gt; next;
      }
  
     }
    }
   out_stream3.setf(ios::fixed);
   out_stream3.setf(ios::showpoint);
   out_stream3.precision(2);
   while((price== (price*1.00)) &amp;&amp; (itemnum == (itemnum*1)))
    {
     while (out_stream3 &lt;&lt; itemnum &lt;&lt; price)
      {
       while (out_stream3.eof())  // reads file to end of file
       {
       out_stream3 &lt;&lt; itemnum;
       out_stream3 &lt;&lt; price;
       price++;
       curr_total= price++;
       out_stream3 &lt;&lt; curr_total;
       cin.clear();  // allows more reading
       cin &gt;&gt; next;
       }
      return itemnum, price;
     }
    }
   in_stream4.setf(ios::fixed);
   in_stream4.setf(ios::showpoint);
   in_stream4.precision(2);
   while ( in_stream4.eof())
   {
    in_stream4 &gt;&gt; itemnum &gt;&gt; price &gt;&gt; curr_total;
    cin.clear();
    cin &gt;&gt; next;
   }
   out_stream5.setf(ios::fixed);
   out_stream5.setf(ios::showpoint);
   out_stream5.precision(2);
   out_stream5 &lt;&lt;setw(5)&lt;&lt; " itemnum " &lt;&lt;setw(5)&lt;&lt;" price "&lt;&lt;setw(5)&lt;&lt;" curr_total " &lt;&lt;endl; // sends items and prices to receipt.txt 
   out_stream5 &lt;&lt; setw(5) &lt;&lt;  itemnum &lt;&lt; setw(5) &lt;&lt;price &lt;&lt; setw(5)&lt;&lt; curr_total; // sends items and prices to receipt.txt 
   out_stream5 &lt;&lt; " You have a total of " &lt;&lt; wrong++ &lt;&lt; " errors " &lt;&lt; endl; 
  
  
  }
  </code></pre>