Wednesday, 16 January 2013

File Write in c++


  //File write ........
                   //tabel of any number write into file

   #include <iostream>
   #include <conio>
   #include <fstream>


       void main()

     {

        int i,a,c;

        cout<<"Enter any number\t"<<endl;
        cin>>a;

       ofstream myfile("abc.text");
       if(!a)
       {
        cout<<"file is not opened\n";
       }

       i=1;
       while(i<=10)
       {
        c=a*i;
        myfile<<a<<"*"<<i<<"="<<c<<endl;
        i++;
       }

    getch(); }

0 comments:

Post a Comment