#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
   string Text;
   filebuf my_file;
   if (my_file.open("witz1.txt",ios::out) == NULL)
   {
      cerr <<"Kann Datei nicht oeffnen\n";
      exit(1);
   }
   Text="Es kommt ein Mann zum Baecker und sagt: Ich moechte 99 Broetchen.\n";
   Text+="Da fragt der Baecker: Duerfen es auch 100 sein?\n";
   Text+="Der Mann antwortet: Nein, wer koennte denn so viele essen?\n";

   ostream my_out(&my_file);
   my_out << Text;
 
   return 0;
}