#include<fstream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<iostream.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
      void deposit(void);
      void addrecord();
      void delrecord();
      void modrecord();
      void disprecord();
      void dispall();
      void withdraw();
   float w,z;
                 class account
  {
                  int accountno,cls;
                  char name[30],type;
                  float deposit,withdraw;
  public:
                  account()
 {
                deposit=withdraw=0;
    }
                    int giveaccountno()
 {
                      return accountno;
    }
                void getdata(int mrno)
 {
                    accountno=mrno+1;
                      cout<<"\t\t\tACCOUNT NUMBER:";
                      cout<<accountno<<" \n";
                      cout<<"\t\t\tENTER YOUR NAME:";
                gets(name);
                      cout<<" ";
                    cout<<"\t\t\tENTER TYPE OF ACCOUNT SAVING(s)/CURRENT(c):";
                cin>>type;
                   cout<<" ";
                   cout<<"\t\t\tENTER INITIAL AMOUNT:Php.";cin>>deposit;
                   cout<<" ";
	clrscr();
  }
                void withdrawal(int m)
   {
                   cout<<"\n\n\n\n\n\n\n\n\n\t\tAMOUNT BEFORE WITHDRAWING:Php."<<deposit<<"";
      deposit=deposit-m;
                   cout<<"\n\n\t\tAMOUNT AFTER WITHDRAWING:Php."<<deposit;
    }
                void deposital(int m)
 {
                   cout<<"\n\n\n\n\n\n\n\n\n\t\tAMOUNT BEFORE DEPOSIT:Php."<<deposit<<"";
    deposit=deposit+m;
                   cout<<"\n\n\t\tAMOUNT AFTER DEPOSIT :Php."<<deposit;
  }
                void dispdata()
   {
                                 int scrnt=0;
                     if(scrnt==1)
    {
      clrscr();
                   cout<<"\t\t\tDISPLAY ALL MENU ";
    scrnt=0;
  }
                    cout<<"\n\t\t\tACCOUNT NUMBER:";
                    cout<<accountno;
                    cout<<"\n\t\t\tNAME OF DEPOSITOR:";
                    cout<<name;
                    cout<<"\n\t\t\tTYPE OF ACCOUNT SAVING(s)/CURRENT(c):";
                    cout<<type;
                    cout<<"\n\t\t\tBALANCE :Php.";
                    cout<<deposit;
    scrnt++;
     }
  };

                void main()
    {
                                 int menuch;
                                      
                 do
    {
                    clrscr();
                    textcolor(14);
                    textbackground(1);
		   cout<<"\n\t\t\tKIKIMUT BANKING SYSTEM...";
                   cout<<"\n\n\n\n\n\n\n\n\t\t\tMAIN MENU\n";
                   cout<<"\n\t\t\t1.NEW ACCOUNT";
                   cout<<"\n\t\t\t2.CLOSE AN ACCOUNT";
                   cout<<"\n\t\t\t3.MODIFY AN ACCOUNT";
                   cout<<"\n\t\t\t4.DISPLAY AN ACCOUNT";
                   cout<<"\n\t\t\t5.DISPLAY ALL RECORDS";
                   cout<<"\n\t\t\t6.WITHDRAW AMOUNT";
                   cout<<"\n\t\t\t7.DEPOSIT AMOUNT";
                   cout<<"\n\t\t\t8.EXIT";
                   cout<<"\n\t\t\tENTER YOUR CHOICE:";
      cin>>menuch;

                                 switch(menuch)
    {

                   case 1:addrecord();break;
                   case 2:delrecord();break;
                   case 3:modrecord();break;
                   case 4:disprecord();break;
                   case 5:dispall();break;
                   case 6:withdraw();break;
                   case 7:deposit();break;
     }
  }
                 while(menuch!=8);
     }
                  void addrecord()
  {
                                     account obj_1,obj_2;
                                  fstream fout;
                   fout.open("banking.txt",ios::in|ios::binary);
     if(!fout)
  {
		clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\tFILE OPEN ERROR";getch();return;}
                int recsize=sizeof(account);
                    fout.seekg(0,ios::end);
                  fout.seekg(-1*recsize,ios::cur);
                 fout.read((char*)&obj_1,recsize);
    int mrno=obj_1.giveaccountno();
                fout.close();
    clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tADD MENU\n";
     obj_2.getdata(mrno);
                  fout.open("banking.txt",ios::app|ios::binary);
     if(!fout)
   {
                    cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tFILE OPEN ERROR";getch();return;}
      fout.write((char*)&obj_2,recsize);
                    cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tRECORD ADDED TO DATABASE\n"<<"\n\t\t\tPress any key to continue... ";
      getch();
                 fout.close();
   }
                void dispall()
  {
                                  account obj_3;
                    fstream fout;
                  int recsize=sizeof(account);
                   int countrec=0;
                clrscr();
                    cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tDISPLAY ALL MENU\n\n ";
    fout.open("banking.txt",ios::in);
                if(!fout)
  {
		clrscr();
                    cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tFILE OPEN ERROR  ";getch();return;}
                while(fout.read((char*)&obj_3,recsize))
  {
                   obj_3.dispdata();
     countrec++;
                    cout<<"\n\n\t\t\tPRESS ANY KEY FOR NEXT....\n\n";
     getch();
  }
                  clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tEND OF FILE.TOTAL NUMBER OF RECORDS..."<<countrec;
                   cout<<"\n\n\t\t\tPress any key to continue......";
    getch();
      fout.close();}
                void disprecord()
 {
                                   account obj_4;
                   fstream fout;
                     int mrno,flag=0;
                    int recsize=sizeof(account);
    clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\tDISPLAY A RECORD MENU\n";
    fout.open("banking.txt",ios::in);
                    if(!fout)
   {
	clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tFILE OPEN ERROR  ";getch();return;}
                   cout<<"\n\t\t\tENTER  THE ACCOUNT NUMBER:";cin>>mrno;
     while(fout.read((char*)&obj_4,recsize))
 {
     if (obj_4.giveaccountno()==mrno)
{
                   obj_4.dispdata();
                    cout<<"\n\n\t\t\tPress any key to continue.....";
     flag=1;break;
  }
 }
     if(flag==0)
  {
	clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\tNO SUCH ACCOUNT EXIST";
     cout<<"\n\t\t\tPress any key......";
  }
                getch();
    fout.close();
 }
                void delrecord()
  {
                                    account obj_5;
                                 fstream fout,temp;
                  int mrno,flag;
                   int recsize=sizeof(account);
     clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\tCLOSE ACCOUNT MENU\n";
     fout.open("banking.txt",ios::in);
                 if(!fout)
 {
		clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\t\tFILE OPEN ERROR";
                    getch();
                   return;
    }
      temp.open("temp.txt",ios::app|ios::binary);
    if(!temp)
 {
	clrscr();
                    cout<<"\n\n\n\n\n\n\n\n\n\n\t\t\t\tFILE OPEN ERROR";
                getch();
     return;
  }
                    cout<<"\n\t\t\tENTER THE ACCOUNT NUMBER:";
                cin>>mrno;
	clrscr();
                  while(fout.read((char*)&obj_5,recsize))
   {
                 if(obj_5.giveaccountno()==mrno)
 {
                   obj_5.dispdata();
                char confirm;
		clrscr();
                    cout<<"\n\n\n\n\n\n\n\n\n\t\t\tARE YOU SURE TO DELETE IT(Y/N)..";cin>>confirm;
      if(confirm=='Y'||confirm=='y')
 {
                   fout.read((char*)&obj_5,recsize);
			clrscr();
                  cout<<"\n\n\n\n\n\n\n\n\n\t\t\tRECORD DELETED FROM DATABASE\n";
                  cout<<"\n\t\t\tpress any key to continue....";
                      flag=1;
                                 if(!fout)
                 break;
      }
                    flag=1;	
     }
   temp.write((char*)&obj_5,recsize);}
                 fout.close();
    temp.close();
                    remove("banking.txt");
                  rename("temp.txt","banking.txt");
                    if(flag==0)
 {
                   cout<<"NO SUCH ACCOUNT EXIST\n";
                   cout<<"Press any key to continue.....\n";
  }
     getch();
 }
                 void modrecord()
  {
    account obj_6;
                fstream fout;
                  int mrno,flag=0;
                  int recsize=sizeof(account);
    clrscr();
                    cout<<"\n\n\n\n\n\n\n\n\n\t\t\tMODIFY RECORD MENU\n";
    fout.open("banking.txt",ios::in|ios::out|ios::binary);
     if(!fout)
 {
                   cout<<"FILE OPEN ERROR";
                   getch();
                    return;
                   }
     fout.seekg(ios::beg);
                   cout<<"\n\t\t\tENTER RECORD NUMBER:";
                    cin>>mrno;
      while(fout.read((char*)&obj_6,recsize))
  {
                  if(obj_6.giveaccountno()==mrno)
  {
                clrscr();
                  cout<<"\n\n\t\t\tOLD DATA\n";
                      obj_6.dispdata();
	int tmprno=obj_6.giveaccountno()-1;
                      account obj_7;
			 cout<<"\n\n\t\t\tENTER NEW DATA\n\n";
                     obj_7.getdata(tmprno);
                  char confirm;
      cout<<"\n\n\n\n\n\n\n\n\n\t\t\tARE YOU SURE(Y/N)  ";
                cin>>confirm;
     if(confirm=='Y'||confirm=='y')
 {
                                  fout.seekg(-1*recsize,ios::cur);
                       fout.write((char*)&obj_7,recsize);
		clrscr();
                   cout<<"\n\n\n\n\n\n\n\n\n\t\t\tRECORD MODIFIED";
                  cout<<"\n\t\t\tPress any key to continue.....";
                                    flag=1;
  }
     }
                  if(flag==0)
 {
		clrscr();
                                 cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\tNO SUCH RECORD EXIST\n";
                       cout<<"\t\t\tPress any key to continue.....\n";
   }
      }
                                 fout.close();
                    getch();
    }
                 void withdraw()
    {
                     account obj_9;
                fstream fout;
    int mrno=0;
  int recsize=sizeof(account);
                   clrscr();
                       cout<<"\n\n\n\n\n\n\n\n\n\t\t\tWITHDRAWAL MENU";
                  fout.open("banking.txt",ios::in|ios::out|ios::binary);
                                  if(!fout)
     {
                   cout<<"FILE OPEN ERROR";getch();return;}
                       fout.seekg(ios::beg);
                   cout<<"\n\n\t\t\tENTER ACCOUNT NUMBER:";
      cin>>mrno;
                      while(fout.read((char*)&obj_9,recsize))
 {
                    if(obj_9.giveaccountno()==mrno)
      {
                 clrscr();
                 cout<<"\n\n\n\n\n\n\n\n\n\t\tENTER THE AMOUNT TO BE WITHDRAWN:Php.";
    cin>>w;
		clrscr();
                    obj_9.withdrawal(w);
                                  fout.seekg(-1*recsize,ios::cur);
                   fout.write((char*)&obj_9,recsize);
  }
    }
                  fout.close();
                      getch();
  }

                    void deposit(void)
  {
                  account obj_10;
      fstream fout;
                 int mrno=0;
      int recsize=sizeof(account);
     clrscr();
                    cout<<"\n\n\n\n\n\n\n\n\n\t\t\tDEPOSITAL MENU\n";
                fout.open("banking.txt",ios::in|ios::out|ios::binary);
   if(!fout)
 {
                  cout<<"FILE OPEN ERROR";getch();return;}
     fout.seekg(ios::beg);
                  cout<<"\n\t\t\tENTER ACCOUNT NUMBER:";
                cin>>mrno;
                  while(fout.read((char*)&obj_10,recsize))
  {
      if(obj_10.giveaccountno()==mrno)
  {
    clrscr();
     cout<<"\n\n\n\n\n\n\n\n\n\t\tENTER THE AMOUNT TO BE DEPOSITED:Php.";
   cin>>w;
	clrscr();
      obj_10.deposital(w);
  fout.seekg(-1*recsize,ios::cur);
      fout.write((char*)&obj_10,recsize);
   }
     }
  fout.close();
     getch();
   }

If you want to convert that to C language then replace cout with printf() statements, fout with FILE, seeg() with fseek(), etc.

what about the cin???

scanf()

Have a quick read over a basic C tutorial

what about others...
plss help me about my program..
i had less info in converting iostream to stdio...
would you edit this code and then repost with an stdio.h and conio.h format..
i would really appreciate...

ah ok..

by the way thanks....

someone pls!!!

i really need some help...

i hope someone will help me and repost my program that is already in some stdio and conio format. or just post what will be replaced and what will i replace. thnk you..

If you keep bumping your thread unnecessarily, I'll close it. Be patient and if someone wants to help, they'll help.

sorry...
i didnt mean on just bumping on this thread..
-_-
sorry again

sorry

why don't you convert it yourself? If you need help converting something specific then ask and post what you have done. Nobody here is going to do your work for you.

I am still confused why do you want to do this. I just can wonder that probably your implementation lacks a C++ compiler and hence you want to convert the C++ code to C.
Well, the very first compiler(cfront), made by Bajane Stroustrup actually did this thing only. It converted C++ code to C code. I don't think cfront is being maintained now. But I heard that certain compiler can actually do this. This doesn't mean that the code will be readable after conversion. This just means that it will compile with a C compiler.
If you want to convert this code to C for educational purpose, nothing beats a programmer who knows a little C and C++ both. So its best to actually compile this code in C compiler and check where at what point the compiler complaints. And then do a little bit of googling and find out what is the alternative to those commands in C.
Wish you luck.
PS: If you really thought that you will yell out HELP and some wizard will convert your C++ code to C, you probably were over dreaming.

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.