Hello,
the following code doesn't work.
The compiler gives the message: crosses initialization of 'std::ofstream filestream
Maybe someone could explain the reason for this.

switch(x)
      {  
        case '7':
        ofstream filestream("Test.txt",ios::out|ios::app);
        //...
        break;

        case '8':
        cout<<This is a test.";
        break;
      } 

use brackets or declare ofstream object before the switch statement.

switch(x)
      {  
        case '7':
        {
            ofstream filestream("Test.txt",ios::out|ios::app);
            //...
        }
        break;

        case '8':
        cout<<This is a test.";
        break;
      }