#include<iostream.h>
#include<fstream.h>
#include<cstdio>
#include<typeinfo>
#include<cstring>
#include<sstream>
#include<algorithm>
#include<ctime>

    char* itoa(int n, char *buf,int)
//            {
//               ostring out;
//               out<<n;
//               strcpy(buf,out.str(),c_str();
//               return buf;     
//             }
 
 
 

class string
class const
struct Node 
class VCDdetails
{
       private:
         char vcdid[6];
         char movietitle[50];
         char castofmovie[50];
         int numvcdcopy;
         
  public:
  
   void addVCDdetails()
  {
                 char vChoice='y';
                 do
                 {
                         int end;
                         fstream VCDauto;
                         VCDauto.open("VCDdetails.TXT",ios::app);
                         char V[12];
                         cout<<"Adding VCD Details"<<endl;
                         VCDauto.seekg(0,ios::end);
                         end=VCDauto.tellg();
                         if(end==0)
                         {
                                  VCDauto.close();
                                  strcpy(vcdid,"V0001");
                         }
                         else
                        {
                                  VCDauto.close();
                                  fstream VCDauto1;
                                  VCDauto1.open("VCDdetails.TXT",ios::app);
                                  while(VCDauto1)
                                  {
     VCDauto1.read((char*)this, sizeof(vcdid));
                                  }
                                  VCDauto1.close();
                                  int VCDcode;
                                  char VCD[6];
                                  VCD[0]=vcdid[1];
                                  VCD[1]=vcdid[2];
                                  VCD[2]=vcdid[3];
                                  VCD[3]=vcdid[4];
                                  VCD[4]='\0';
                                  VCDcode=atoi(VCD);
                                  VCDcode++;
                                  if(VCDcode<=9)
                                  {
                                          strcpy(vcdid,"V000");
                                             strcat(vcdid,itoa(VCDcode,V,20));
                                  }
            if(VCDcode>9 && VCDcode<=99)
                {
                                          strcpy(vcdid,"V00");
                                          strcat(vcdid,itoa(VCDcode,V,10));
                                  }
                                  if(VCDcode>99 && VCDcode<=999)
                                  {
                                          strcpy(vcdid,"V0");
                                          strcat(vcdid,itoa(VCDcode,V,10));
                                  }
                                  if(VCDcode>999 && VCDcode<=9999)
                                  {
                                            strcpy(vcdid,"V");
                                             strcat(vcdid,itoa(VCDcode,V,10));
                                  }
        }
                
    
    
     cout<<"Enter movie title:"<<endl;
                 cin.get();
                 cin.getline(movietitle,50);
                 do
                 {
                  if(strlen(movietitle)==0)
                         {
    cout<<"Cannot leave empty. Enter movie title again!"<<endl;
                          cin.getline(movietitle,50);
                         }
                         else
                         {
                         break;
                         }
                 }while(strlen(movietitle)==0);
                 cout<<"Enter cast of movie:"<<endl;
                 cin.getline(castofmovie,50);
                 do
                 {
                  if(strlen(castofmovie)==0)
                         {
                          cout<<"Cannot leave empty. Enter the cast of movie again!"<<endl;
       cin.getline(castofmovie,50);
                         }
                         else
                         {
                         break;
                         }
                 }while(strlen(castofmovie)==0);
                 cout<<"Enter no of VCD copies:"<<endl;
                 cin>>numvcdcopy;
     fstream VCDfile("VCDdetails.TXT",ios::app);
                 VCDfile.write((char *)this,sizeof(VCDdetails));
                 VCDfile.close();
                 cout<<"\nContinue adding VCD details?";
                 cin>>vChoice;
                 }while(vChoice!='n');
                 }  
                
};
 
 
 
 
int main()
{
 VCDdetails.VCDobj;
 VCDobj.addVCDdetails();
 

return 0;

}

Recommended Answers

All 5 Replies

where from did you copy? What problems are you facing?

line 140 -- replace the dot with a space to declare an object.

commented: Was there any point of adding code tags? -2

Solve what? It's C++ code. It's long. It compiles -- or not. Are we supposed to figure out what it's supposed to do?

Advice?
read this and this

Why don't you do as the error message says and replace the dot with a space?

Member Avatar for iamthwee

>iostream.h, fstream.h

No doubt you're using a crappy compiler as well... let me guess the old version of turbo c?

commented: yes there was a point to adding code tags, please read the rules -3
commented: It doesn't matter what compiler he uses. +3
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.