#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<process.h>
#include<dos.h>
#include<time.h>
#include<fstream.h>
#include<string.h>


class getInfo
{
   int   dep;
   int   with;
   int   bal;
   int   year;
   int   mon;
   int   day;
   char  des[100];

   public:


   getInfo()
   {
    dep  =0;
    with =0;
    bal  =0;
    year =0;
    mon  =0;
    day  =0;

    strcpy(des,"");

   }

   int year1()
   {
	return year;
   }

   int month1()
   {
	return mon;
   }

   int day1()
   {
	return day;
   }



   void gInfo()
   {
      int c;
      struct date a;
      getdate(&a);

      fflush(stdin);
      year=a.da_year;
      fflush(stdin);
      mon=a.da_mon;
      fflush(stdin);
      day=a.da_day;

   	cout<<"1. Deposit."<<endl;
   	cout<<"2. Withdraw."<<endl<<endl;
      cout<<"Enter your choice:";
      fflush(stdin);
      cin>>c;

      clrscr();

   	cout<<"Enter the discription:";
      fflush(stdin);
      cin>>des;

      cout<<"Enter the Amount:";



      if(c==1)
		{
      	fflush(stdin);
      	cin>>dep;

       }

      else
       {	fflush(stdin);
			cin>>with;

        }
     fflush(stdin);
     bal=balance(dep,with);

   }


  int balance(int dep,int with)
  {
    getInfo I4;
    fstream b;
    int s=0;

    b.open("myExpn.txt",ios::in);
    b.seekg(0,ios::cur);

    while(!b.read((char*)&I4,sizeof(I4))==0)
    {
      s=I4.bal;
    }
    //cout<<s;
    //getch();
    s=s+dep-with;
    b.close();
    return s;


  }




   void
   putInfo(int i)
   {
      gotoxy(2,i);cout<<year<<"/"<<mon<<"/"<<day;
      gotoxy(20,i);cout<<des;
      gotoxy(45,i);cout<<dep;
      gotoxy(58,i);cout<<with;
      gotoxy(69,i);cout<<bal;
   }


};


class file
{

 public:

  void wFile()

  {                     
	      getInfo I;

	      fstream a;
	      a.open("myExpn.txt",ios::app);

	      I.gInfo();



	      a.write((char*)&I,sizeof(I));

	      a.close();


	    }


  void rFile()
 {

	      int j=3;
	      getInfo I;

	      fstream a;
	      a.open("myExpn.txt",ios::in);

	      a.seekg(0,ios::beg);

	      window(1,3,80,25);



	      while(!a.read((char*)&I,sizeof(I))==0)
	      {

		 I.putInfo(j);
		 cout<<endl;
		 j++;

		 if(j==18)
			j=0;
	      }

	      a.close();


	    }







   void search()
   {


	      int j=3;
	      int d;
	      int c;
	      int m;
	      int y;
	      int s=1;
	      int m1;
	      getInfo I;
	      fstream a;

	      cout<<"1. Search by date." <<endl;
	      cout<<"2. Search by month."<<endl<<endl;
	      cout<<"Enter your choice:";
	      cin>>c;

	      if(c==1)
	      {
		cout<<"Enter the date in dd\mm\yyy:"<<endl;
		cin>>d>>m>>y;
	      }

	     if(c==2)
	     {
		cout<<"Enter the month:";
		cin>>m1;
	     }








	      a.open("myExpn.txt",ios::in);

	      a.seekg(0,ios::beg);



	      //window(1,3,80,25);
	      clrscr();
	      show();

	      while(!a.read((char*)&I,sizeof(I))==0)
	      {




		if(c==1)
		{


		 if(y==I.year1() && d==I.day1() && m==I.month1())
		 {

		 I.putInfo(j);
		 cout<<endl;
		 j++;
		 s++;

		 }

		 else
		 {

		   if(m1==I.month1())
		   {
		      I.putInfo(j);
		      cout<<endl;
		      j++;
		      s++;
		   }
		 }



		 }


	      }

	      a.close();

	 if(s==1)
	 {
		clrscr();
		cout<<"No recotds are found.............";
	 }
   }


    void show()
{
	       gotoxy(2,1);cout<<"Date";
	      gotoxy(20,1);cout<<"description";
	       gotoxy(45,1);cout<<"Deposit";
	       gotoxy(58,1);cout<<"Withdraw";
	       gotoxy(69,1);cout<<"Balance";

}





};




void main()
{
   file f;
   int c;

   //getInfo I;
  while(1)
  {

   window(1,1,80,25);
   textbackground(18);
   textcolor(5);



	clrscr();



   cout<<"1. Make a transection."<<endl;
   cout<<"2. Show all transection"<<endl;
   cout<<"3. search."<<endl;
   cout<<"4. Exit"<<endl;

   cout<<endl<<"Enter your choice:";
   cin>>c;

   clrscr();

   switch(c)
   {
     case 1:
	       f.wFile();
	       break;
     case 2:

	      f.show();
	       f.rFile();
	       break;

     case 3:

	     f.search();
	     break;


     case 4:
	    exit(0);

   }


   gotoxy(12,19);
   cout<<"Press any key to continue............";

   getch();




   }




}

Post your code inside of code tags:

[code] /* code */ [/code]

No code tags, a bunch of code, and no question. Awesome. :icon_rolleyes:

#include<conio.h>
#include<stdio.h>
#include<iostream.h>
#include<process.h>
#include<dos.h>
#include<time.h>
#include<fstream.h>
#include<string.h>


class getInfo
{
   int   dep;
   int   with;
   int   bal;
   int   year;
   int   mon;
   int   day;
   char  des[100];

   public:


   getInfo()
   {
    dep  =0;
    with =0;
    bal  =0;
    year =0;
    mon  =0;
    day  =0;

    strcpy(des,"");

   }

   int year1()
   {
	return year;
   }

   int month1()
   {
	return mon;
   }

   int day1()
   {
	return day;
   }



   void gInfo()
   {
      int c;
      struct date a;
      getdate(&a);

      fflush(stdin);
      year=a.da_year;
      fflush(stdin);
      mon=a.da_mon;
      fflush(stdin);
      day=a.da_day;

   	cout<<"1. Deposit."<<endl;
   	cout<<"2. Withdraw."<<endl<<endl;
      cout<<"Enter your choice:";
      fflush(stdin);
      cin>>c;

      clrscr();

   	cout<<"Enter the discription:";
      fflush(stdin);
      cin>>des;

      cout<<"Enter the Amount:";



      if(c==1)
		{
      	fflush(stdin);
      	cin>>dep;

       }

      else
       {	fflush(stdin);
			cin>>with;

        }
     fflush(stdin);
     bal=balance(dep,with);

   }


  int balance(int dep,int with)
  {
    getInfo I4;
    fstream b;
    int s=0;

    b.open("myExpn.txt",ios::in);
    b.seekg(0,ios::cur);

    while(!b.read((char*)&I4,sizeof(I4))==0)
    {
      s=I4.bal;
    }
    //cout<<s;
    //getch();
    s=s+dep-with;
    b.close();
    return s;


  }




   void
   putInfo(int i)
   {
      gotoxy(2,i);cout<<year<<"/"<<mon<<"/"<<day;
      gotoxy(20,i);cout<<des;
      gotoxy(45,i);cout<<dep;
      gotoxy(58,i);cout<<with;
      gotoxy(69,i);cout<<bal;
   }


};


class file
{

 public:

  void wFile()

  {                     
	      getInfo I;

	      fstream a;
	      a.open("myExpn.txt",ios::app);

	      I.gInfo();



	      a.write((char*)&I,sizeof(I));

	      a.close();


	    }


  void rFile()
 {

	      int j=3;
	      getInfo I;

	      fstream a;
	      a.open("myExpn.txt",ios::in);

	      a.seekg(0,ios::beg);

	      window(1,3,80,25);



	      while(!a.read((char*)&I,sizeof(I))==0)
	      {

		 I.putInfo(j);
		 cout<<endl;
		 j++;

		 if(j==18)
			j=0;
	      }

	      a.close();


	    }







   void search()
   {


	      int j=3;
	      int d;
	      int c;
	      int m;
	      int y;
	      int s=1;
	      int m1;
	      getInfo I;
	      fstream a;

	      cout<<"1. Search by date." <<endl;
	      cout<<"2. Search by month."<<endl<<endl;
	      cout<<"Enter your choice:";
	      cin>>c;

	      if(c==1)
	      {
		cout<<"Enter the date in dd\mm\yyy:"<<endl;
		cin>>d>>m>>y;
	      }

	     if(c==2)
	     {
		cout<<"Enter the month:";
		cin>>m1;
	     }








	      a.open("myExpn.txt",ios::in);

	      a.seekg(0,ios::beg);



	      //window(1,3,80,25);
	      clrscr();
	      show();

	      while(!a.read((char*)&I,sizeof(I))==0)
	      {




		if(c==1)
		{


		 if(y==I.year1() && d==I.day1() && m==I.month1())
		 {

		 I.putInfo(j);
		 cout<<endl;
		 j++;
		 s++;

		 }

		 else
		 {

		   if(m1==I.month1())
		   {
		      I.putInfo(j);
		      cout<<endl;
		      j++;
		      s++;
		   }
		 }



		 }


	      }

	      a.close();

	 if(s==1)
	 {
		clrscr();
		cout<<"No recotds are found.............";
	 }
   }


    void show()
{
	       gotoxy(2,1);cout<<"Date";
	      gotoxy(20,1);cout<<"description";
	       gotoxy(45,1);cout<<"Deposit";
	       gotoxy(58,1);cout<<"Withdraw";
	       gotoxy(69,1);cout<<"Balance";

}





};




void main()
{
   file f;
   int c;

   //getInfo I;
  while(1)
  {

   window(1,1,80,25);
   textbackground(18);
   textcolor(5);



	clrscr();



   cout<<"1. Make a transection."<<endl;
   cout<<"2. Show all transection"<<endl;
   cout<<"3. search."<<endl;
   cout<<"4. Exit"<<endl;

   cout<<endl<<"Enter your choice:";
   cin>>c;

   clrscr();

   switch(c)
   {
     case 1:
	       f.wFile();
	       break;
     case 2:

	      f.show();
	       f.rFile();
	       break;

     case 3:

	     f.search();
	     break;


     case 4:
	    exit(0);

   }


   gotoxy(12,19);
   cout<<"Press any key to continue............";

   getch();




   }




}

dos.h so far so good. Now go into your autoexec.bat and config.sys files and be sure to run emm386.exe to get your 4k of expanded memory going. Also set your soundblaster IRQ to 7, and set files=70 just in case your dos computer is very strong and can run a lot of files at once.

Nikesh2014: As Narue says, you didn't actually post a question, which makes it hard to give a useful answer. What seems to be the problem?

(Aside from the fact that you are using an ancient compiler, that is. Turbo C++, I'm guessing, given how many schools seem to have standardized on it even after 20+ years. Interestingly enough, MinGW - and hence Code::Blocks - does include a <dos.h> header, but it appears to be completely different from the Turbo C++ header file.)

If you are trying to compile this with a newer compiler, well, in the words of the great Jamie Hyneman, "There's your problem!" This code depends on a number of functions that were specific to Turbo C++, and while some are re-implemented in newer libraries, the getdate() function and the date structure are not. It would take significant work to try and bring this code up to modern standards.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.