Hey everyone,

I am using Visual Studio 2008 to debug some code where the goal is create a linked list using pointer variables. Here is the main error I am getting when trying to compile:

error C2227: left of '->Account' must point to class/struct/union/generic type      type is 'Link_t'

If I can figure out what it means, I will be able to get like 98% of the code debugged.

At any rate here is my code, any help would be appreciated because linked lists are giving be a great bit of trouble

//Assignment 8
//Linked Lists
//Pointer Variable Implementation
//Devang Joshi

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <fstream>
using namespace std;

//*************************************************************************************************  
      				                   /* Global Variables */    
//*************************************************************************************************
 
    const int NAMESIZE=25;
    const int FILENAME=51;
    const int MAXLISTSIZE=200;       
  
    typedef char Name_t[NAMESIZE];
    typedef char Filename_t[FILENAME];
    typedef int ID_t;
    typedef double Bal_t;
    typedef fstream Infile_t;
    typedef fstream Outfile_t;
    typedef int Link_t;       
 
      
//*************************************************************************************************
      				               /* Class Declerations */   
//*************************************************************************************************

    class cAccount
    {
		private:
			
		    Name_t fname;
      		Name_t lname;
      		ID_t aID;
      		Bal_t aBal;       

      	public:       

      		cAccount();                       
      		void Read (Infile_t &Infile);     
      		void Print (Outfile_t &Outfile);  
      		void Display();                   
      	    int compID2ID(cAccount NewAccount);      		   

      };// end cAccount       
//*************************************************************************************************
      				              /* Struct Declerations */
//*************************************************************************************************
 
      struct LLEle_t
      {
	      cAccount Account;
      	  LLEle_t * Link_t;       

      };// end ListEle_t     
//*************************************************************************************************
				                   /* Link Decleration */ 
//*************************************************************************************************

      typedef LLEle_t * Link;      

//*************************************************************************************************
      			             /* Class Function Implementations */       
//*************************************************************************************************
      cAccount::cAccount()
      {
	      strcpy(fname,"");
      	  strcpy(lname,"");                                                
      	  aID=0;
      	  aBal=0;  
	  
	  }// end cAccount::cAccount       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 
      void cAccount::Read(Infile_t &Infile)
	  { Infile>>aID>>lname>>fname>>aBal;}// end cAccount::Read              
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Print(Outfile_t &Outfile)  
      {
	      Outfile<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl; 
      	  Outfile<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;      
      	  Outfile<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl; 
      	  Outfile<<"------------------------------------------------"<<endl;  
  
	  }// end cAccount::Print           
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Display()
      {
	      cout<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl;
      	  cout<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;        
      	  cout<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl;
      	  cout<<"------------------------------------------------"<<endl;       
 
      }// end cAccount::Display       
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      int cAccount::compID2ID(cAccount NewAccount)
      {
		  int count;
      	  count=0;       

      	  if(this->aID > NewAccount.aID)
      	  { count=-1;}// end if     

	      else if(this->aID < NewAccount.aID)       
      	  { count=1; }// end else if       

		  else
      	  { count=0;}//end else       

      	  return count;

      }// end cAccount::compID2ID    
//*************************************************************************************************
      				                   /* Function Prototypes */
//*************************************************************************************************
 
      void Insert(Link_t &Head, Link_t &Pred,cAccount NewAccount); 
      void Search4Pred(Link_t &Pred,Link_t List,Link_t Start, cAccount Account);  
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount);  
      void Load(Link_t &Start,Link_t &Avail);  
      void Display(Link_t Start, Link_t Avail);
	  void Print(Link_t Start,Link_t Avail);   
      
//*************************************************************************************************
      					                       /* MAIN */       
//*************************************************************************************************

      int main()
      {
		  int COUNT=0; 
      	  Link_t Start=0; 
      	  Link_t Avail=0;
      	  cAccount Account;
      	  Infile_t Infile;

          /* FUNCTION CALLS */

      	  Load(Start,Avail);
      	  Display(Start,Avail);
      	  Print(Start,Avail);
      	  
      	  return 0;

      }// end main 
//************************************************************************************************* 
      				               /* Function Implementations */   
//*************************************************************************************************
      void Insert(Link_t &Head, Link_t &Pred,cAccount NewAccount)
      {
		  Link_t Curr;
      	  Curr=Link;
      	  Curr->Account=NewAccount;       
 
      	  if(Pred!=NULL)
      	  {
		      Curr->Link=Pred->Link;        
      		  Pred->Link=Curr;
      	  }    
	      else
      	  {
      		  Curr->Link = Start;
      		  Start = Curr;
      	  }

      };// end Insert       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Search4Pred(Link_t &Pred,Link_t Start, cAccount Account)
      {
	      bool Done=false; 
      	  Link_t Curr;
      	  Curr=Start;
      	  Pred=NULL;       

     	  while((Done!=true)&&(Curr!=NULL))
      	  {
			  if(Curr->Account.compID2ID(Account)>0)   
      		  {
			      Pred=Curr;
      			  Curr=Pred->Link;
      		  }
      		  else
      		  { Done=true;}
      	  }//end while
      }// end Search4Pred       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount)
      {
	      Link_t Pred;

      	  Search4Pred(Pred,Start,NewAccount);               
      	  Insert(Start,Pred,Avail,NewAccount);

	  }// end Add       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Load(Link_t &Start,Link_t &Avail)
      {
	      Filename_t Filename;
      	  Infile_t Infile;
      	  Link_t Curr=0; 
      	  Link_t Pred=0; 
	      cout<<"Program Starting.........."<<endl;
      	  cout<<"Begining Load.........."<<endl<<endl;
      	  cout<<"Enter the name of the data file to be used:"<<endl;  
      	  cin>>Filename;
      	  Infile.open(Filename,ios::in);
      	  cAccount NewAccount; 
      	  NewAccount.Read(Infile);
      	  while(!Infile.eof())
      	  {
		      Add(Avail,Start,NewAccount);
      		  NewAccount.Read(Infile);

      	  }//end while
 
      	  Infile.close();
      	  cout<<"Read Complete........."<<endl;
	      cout<<"Load Complete........."<<endl;

      };//end load
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Display(Link_t Start, Link_t Avail)
      {
	      Link_t Curr;
      	  Curr=Start;
      	  Name_t choice;
      	  cout<<"Would you like to view the output file?"<<endl;
      	  cout<<"(YES or NO)"<<endl;
      	  cin>>choice;

      	  if(strcmp(choice,"YES")==0||strcmp(choice,"Yes")==0||strcmp(choice,"yes")==0) 
      	  {
			  cout<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;       

      		  while(Curr!=NULL)                                             
      		  {
			      Curr->Account.Display();
      			  Curr=Curr->Link;

      		  }//end while

			  cout<<endl;
			  cout<<"Moving to next process.........."<<endl<<endl;

      	  }//end if
      	  else
      	  {
		      cout<<"Very Well.........."<<endl;
		      cout<<"Moving to next process.........."<<endl<<endl;
      	  }

      };// end Display
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Print(Link_t Start,Link_t Avail)
	  {
	      Link_t Curr;
      	  Curr=Start; 
      	  Filename_t Filename;
      	  Outfile_t Outfile;
      	  cout<<"Enter the name of the output file: "<<endl;
      	  cin>>Filename; 
      	  Outfile.open(Filename,ios::out);
      	  Outfile<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;

      	  while(Curr!=NULL)
      	  {
		      Curr->Account.Print(Outfile);
      		  Curr=Curr->Link;

      	  }//end while       

      	  Outfile.close();
      	  cout<<"Write Sucessful.........."<<endl<<endl;

      };// end Print
//*************************************************************************************************
				                   /* END OF SOURCE CODE */
//*************************************************************************************************
//*************************************************************************************************  
      				                   /* Global Variables */    
//*************************************************************************************************
 
    const int NAMESIZE=25;
    const int FILENAME=51;
    const int MAXLISTSIZE=200;       
 
    typedef char Name_t[NAMESIZE];
    typedef char Filename_t[FILENAME];
    typedef int ID_t;
    typedef double Bal_t;
    typedef fstream Infile_t;
    typedef fstream Outfile_t;
    typedef int Link_t;  //naming conflict
struct LLEle_t
      {
	      cAccount Account;
      	  LLEle_t * Link_t;       //naming conflict
 
      };// end ListEle_t

You've typedefed an int to Link_t. As a result, your duplicating an identifier. Change one or the other, then give an update.

Edited 6 Years Ago by Fbody: n/a

I made the change but I am still getting errors in regard to the pointer belonging to a class I will keep working on it tho and let you know

Look at line 66:

typedef LLEle_t * Link;

Now, review lines 155-157:

Link_t Curr;
      	  Curr=Link;
      	  Curr->Account=NewAccount;

Link_t is defined as an integer, not an integer pointer, I think you intended to create a pointer to your LLEle_t struct, change it to the "Link" typedef. You only use the "arrow operator" to access the members of an object via a pointer. To access the members of an object using the object itself, you must use the "dot operator".

Plus, "Link" is a typedef for a pointer to an element of your linked list, it's not a variable identifier. You are trying to assign the Link type to the variable called Curr, which doesn't work. Based on my previous assumption, this line (line 156) probably should be Curr = new Link; . Depending on what you are trying to accomplish with line 157, this could then make that line a valid line. It's entirely dependent on what "NewAccount" is.

[edit]
Since this seems to be an issue here, here is a tip:
Too many types with very similar names can get confusing. In the future, try to diversify the names more and make them more meaningful. For example, instead of typedef int Link_t and typedef LLEle_t * Link use something like typedef int LinkId and typedef LLEle_t * LinkPointer . These names are more meaningful and easier to remember.

Edited 6 Years Ago by Fbody: (1) clarifications, (2) added tip

Look at line 66:

typedef LLEle_t * Link;

Now, review lines 155-157:

Link_t Curr;
      	  Curr=Link;
      	  Curr->Account=NewAccount;

Link_t is defined as an integer, not an integer pointer, I think you intended to create a pointer to your LLEle_t struct, change it to the "Link" typedef. You only use the "arrow operator" to access the members of an object via a pointer. To access the members of an object using the object itself, you must use the "dot operator".

Plus, "Link" is a typedef for a pointer to an element of your linked list, it's not a variable identifier. You are trying to assign the Link type to the variable called Curr, which doesn't work. Based on my previous assumption, this line (line 156) probably should be Curr = new Link; . Depending on what you are trying to accomplish with line 157, this could then make that line a valid line. It's entirely dependent on what "NewAccount" is.

[edit]
Since this seems to be an issue here, here is a tip:
Too many types with very similar names can get confusing. In the future, try to diversify the names more and make them more meaningful. For example, instead of typedef int Link_t and typedef LLEle_t * Link use something like typedef int LinkId and typedef LLEle_t * LinkPointer . These names are more meaningful and easier to remember.

Ok so let me make sure I am understanding correctly (sorry im such a noob at all this) but should I edit my struct like so then?:

struct LLEle_t
{
	  cAccount Account;
      	  LLEle_t * Link_t;       

};// end ListEle_t

I think im just having trouble understanding the difference between array linked lists and pointer linked lists. This code was an attempt to edit an array linked list and make it into a pointer linked list if that makes sense.

Could you clarify your explanation for me (aka dumb it down)?

thanks,

...

struct LLEle_t
{
	  cAccount Account;
      	  LLEle_t * Link_t;       
 
};// end ListEle_t

...

This won't work unless you have changed "Link_t" in Line 27 (" typedef int Link_t; ") to something else.

I think we need to step out of context for a little bit.

Let me ask you a question:
What do you know about data types, specifically pointers?

This won't work unless you have changed "Link_t" in Line 27 (" typedef int Link_t; ") to something else.

I think we need to step out of context for a little bit.

Let me ask you a question:
What do you know about data types, specifically pointers?

As far as pointers, basically nothing, our professor started out by teaching us about classes, arrays etc..... Then he started to make us typedef specific variables that we use multiple times in our code. From there we learned how to implement a Linked List using an array, and now he has given us this assignment.

I see....

I suggest you read this (click). After you read that, continue reading here.

Essentially, a pointer is a specific data type designed to hold the memory address of another variable or object. Unless your program is specifically designed to be fully conscious of physical memory addresses, they hold no actual data that is useful to your program. They instead facilitate the efficiency of your program and help the computer move through your code.

Pointers require special considerations and operators when you use them. Pointers are not compatible/interchangeable with objects of the pointer's type. For example, an int and an int * are not interchangeable. This is one part of where your errors are coming from, you are trying to use them interchangeably which is illegal without the use of special pointer operators.

The error in your OP:

error C2227: left of '->Account' must point to class/struct/union/generic type type is 'Link_t'

it is referring to this section of your code:

Link_t Curr;
Curr=Link;
Curr->Account=NewAccount;

and is the direct result of you trying to use a variable of type 'Link_t' (which is the same as 'int' mind you) with operators that require a variable of type 'int *' .

RE typedefs:
A typedef is not used for a variable. A typedef is used to create a new name for an existing data type. You have several examples at the beginning of your code. The one I have been discussing with you most is " typedef int Link_t ". This line says "In this program, the int data type is also known as the 'Link_t' data type.".

Edited 6 Years Ago by Fbody: n/a

I see....

I suggest you read this (click). After you read that, continue reading here.

Essentially, a pointer is a specific data type designed to hold the memory address of another variable or object. Unless your program is specifically designed to be fully conscious of physical memory addresses, they hold no actual data that is useful to your program. They instead facilitate the efficiency of your program and help the computer move through your code.

Pointers require special considerations and operators when you use them. Pointers are not compatible/interchangeable with objects of the pointer's type. For example, an int and an int * are not interchangeable. This is one part of where your errors are coming from, you are trying to use them interchangeably which is illegal without the use of special pointer operators.

The error in your OP:

it is referring to this section of your code:

Link_t Curr;
Curr=Link;
Curr->Account=NewAccount;

and is the direct result of you trying to use a variable of type 'Link_t' (which is the same as 'int' mind you) with operators that require a variable of type 'int *' .

RE typedefs:
A typedef is not used for a variable. A typedef is used to create a new name for an existing data type. You have several examples at the beginning of your code. The one I have been discussing with you most is " typedef int Link_t ". This line says "In this program, the int data type is also known as the 'Link_t' data type.".

Thanks that section really helped, I am down to only three errors now using the following code. However the errors are complex and I have included them aswell. Are these errors due to the typedef's? Or is it a mistake on my part of not understanding the proper implementation?

The code:

//Assignment 8
//Linked Lists
//Pointer Variable Implementation
//Devang Joshi

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <fstream>
using namespace std;

//*************************************************************************************************  
      				                   /* Global Variables */    
//*************************************************************************************************
 
    const int NAMESIZE=25;
    const int FILENAME=51;
    const int MAXLISTSIZE=200;       
  
    typedef char Name_t[NAMESIZE];
    typedef char Filename_t[FILENAME];
    typedef int ID_t;
    typedef double Bal_t;
    typedef fstream Infile_t;
    typedef fstream Outfile_t;
    const int NIL=-1; 
 
      
//*************************************************************************************************
      				               /* Class Declerations */   
//*************************************************************************************************

    class cAccount
    {
		private:
			
			Name_t fname;
      		Name_t lname;
      		ID_t aID;
      		Bal_t aBal;       

      	public:       

      		cAccount();                       
      		void Read (Infile_t &Infile);     
      		void Print (Outfile_t &Outfile);  
      		void Display();                   
      	    int compID2ID(cAccount NewAccount);      		   

      };// end cAccount       
//*************************************************************************************************
      				              /* Struct Declerations */
//*************************************************************************************************
 
      struct LLEle_t
      {
	      cAccount Account;
      	  LLEle_t * Link;       

      };// end ListEle_t     
//*************************************************************************************************
				                   /* Link Decleration */ 
//*************************************************************************************************

      typedef LLEle_t * Link_t;      

//*************************************************************************************************
      			             /* Class Function Implementations */       
//*************************************************************************************************
      cAccount::cAccount()
      {
		  strcpy(fname,"");
      	  strcpy(lname,"");                                                
      	  aID=0;
      	  aBal=0;  
	  
	  }// end cAccount::cAccount       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 
      void cAccount::Read(Infile_t &Infile)
	  { Infile>>aID>>lname>>fname>>aBal;}// end cAccount::Read              
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Print(Outfile_t &Outfile)  
      {
	      Outfile<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl; 
      	  Outfile<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;      
      	  Outfile<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl; 
      	  Outfile<<"------------------------------------------------"<<endl;  
  
	  }// end cAccount::Print           
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Display()
      {
	      cout<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl;
      	  cout<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;        
      	  cout<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl;
      	  cout<<"------------------------------------------------"<<endl;       
 
      }// end cAccount::Display       
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      int cAccount::compID2ID(cAccount NewAccount)
      {
		  int count;
      	  count=0;       

      	  if(this->aID > NewAccount.aID)
      	  { count=-1;}// end if     

	      else if(this->aID < NewAccount.aID)       
      	  { count=1; }// end else if       

		  else
      	  { count=0;}//end else       

      	  return count;

      }// end cAccount::compID2ID    
//*************************************************************************************************
      				                   /* Function Prototypes */
//*************************************************************************************************
 
      void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount); 
      void Search4Pred(Link_t &Pred,Link_t List,Link_t Start, cAccount Account);  
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount);  
      void Load(Link_t &Start,Link_t &Avail);  
      void Display(Link_t Start, Link_t Avail);
      void Print(Link_t Start,Link_t Avail);   
      
//*************************************************************************************************
      					                       /* MAIN */       
//*************************************************************************************************

      int main()
      {
		  int COUNT=0; 
      	  Link_t Start=0; 
      	  Link_t Avail=0;
      	  cAccount Account;
      	  Infile_t Infile;

          /* FUNCTION CALLS */

      	  Load(Start,Avail);
      	  Display(Start,Avail);
      	  Print(Start,Avail);
      	  
      	  return 0;

      }// end main 
//************************************************************************************************* 
      				               /* Function Implementations */   
//*************************************************************************************************
      void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount)
      {
          Link_t Curr;
      	  Curr=Link;
      	  Curr->Account=NewAccount;       
 
      	  if(Pred!=NIL)
      	  {
		      Curr->Link=Pred->Link;        
      		  Pred->Link=Curr;
      	  }    
	      else
      	  {
      		  Curr->Link = Start;
      		  Start = Curr;
      	  }

      };// end Insert       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Search4Pred(Link_t &Pred,Link_t Start, cAccount Account)
      {
	      bool Done=false; 
      	  Link_t Curr;
      	  Curr=Start;
      	  Pred=NULL;       

     	  while((Done!=true)&&(Curr!=NULL))
      	  {
			  if(Curr->Account.compID2ID(Account)>0)   
      		  {
			      Pred=Curr;
      			  Curr=Pred->Link;
      		  }
      		  else
      		  { Done=true;}
      	  }//end while
      }// end Search4Pred       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount)
      {
	      Link_t Pred;

      	  Search4Pred(Pred,Start,NewAccount);               
      	  Insert(Start,Pred,Avail,NewAccount);

	  }// end Add       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Load(Link_t &Start,Link_t &Avail)
      {
	      Filename_t Filename;
      	  Infile_t Infile;
      	  Link_t Curr=0; 
      	  Link_t Pred=0; 
	      cout<<"Program Starting.........."<<endl;
      	  cout<<"Begining Load.........."<<endl<<endl;
      	  cout<<"Enter the name of the data file to be used:"<<endl;  
      	  cin>>Filename;
      	  Infile.open(Filename,ios::in);
      	  cAccount NewAccount; 
      	  NewAccount.Read(Infile);
      	  while(!Infile.eof())
      	  {
		      Add(Avail,Start,NewAccount);
      		  NewAccount.Read(Infile);

      	  }//end while
 
      	  Infile.close();
      	  cout<<"Read Complete........."<<endl;
	      cout<<"Load Complete........."<<endl;

      };//end load
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Display(Link_t Start, Link_t Avail)
      {
	      Link_t Curr;
      	  Curr=Start;
      	  Name_t choice;
      	  cout<<"Would you like to view the output file?"<<endl;
      	  cout<<"(YES or NO)"<<endl;
      	  cin>>choice;

      	  if(strcmp(choice,"YES")==0||strcmp(choice,"Yes")==0||strcmp(choice,"yes")==0) 
      	  {
			  cout<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;       

      		  while(Curr!=NULL)                                             
      		  {
			      Curr->Account.Display();
      			  Curr=Curr->Link;

      		  }//end while

			  cout<<endl;
			  cout<<"Moving to next process.........."<<endl<<endl;

      	  }//end if
      	  else
      	  {
		      cout<<"Very Well.........."<<endl;
		      cout<<"Moving to next process.........."<<endl<<endl;
      	  }

      };// end Display
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Print(Link_t Start,Link_t Avail)
	  {
	      Link_t Curr;
      	  Curr=Start; 
      	  Filename_t Filename;
      	  Outfile_t Outfile;
      	  cout<<"Enter the name of the output file: "<<endl;
      	  cin>>Filename; 
      	  Outfile.open(Filename,ios::out);
      	  Outfile<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;

      	  while(Curr!=NULL)
      	  {
		  Curr->Account.Print(Outfile);
      		  Curr=Curr->Link;

      	  }//end while       

      	  Outfile.close();
      	  cout<<"Write Sucessful.........."<<endl<<endl;

      };// end Print
//*************************************************************************************************
				                   /* END OF SOURCE CODE */
//*************************************************************************************************

The Errors:

1>c:\users\devang\documents\visual studio 2008\projects\assign8\assign8\assign8.cpp(156) : error C2065: 'Link' : undeclared identifier
1>c:\users\devang\documents\visual studio 2008\projects\assign8\assign8\assign8.cpp(159) : error C2446: '!=' : no conversion from 'const int' to 'Link_t'
1>        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\devang\documents\visual studio 2008\projects\assign8\assign8\assign8.cpp(159) : error C2040: '!=' : 'Link_t' differs in levels of indirection from 'const int'
void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount)
      {
          Link_t Curr;
      	  Curr=Link;    //<----- line 156, the first line flagged by compiler
      	  Curr->Account=NewAccount;       
 
      	  if(Pred!=NIL) //<--- line 159, the second flagged line
      	  {
		      Curr->Link=Pred->Link;        
      		  Pred->Link=Curr;
      	  }    
	      else
      	  {
      		  Curr->Link = Start;
      		  Start = Curr;
      	  }
 
      };// end Insert

What is line 156 intended to do? As written, you are trying to assign the contents of a variable named "Link" to another variable named "Curr". The issue is that you have not told the compiler what "Link" is.

I see a member variable in your LLEle_t struct named "Link". I suspect that, based on the declaration of "Curr", you are trying to access that element. You are not accessing it correctly. You need to use the "arrow operator" ( -> ) to de-reference the pointer, then assign a value to "Link" through the indirection.

The other error(s) refer to line 159. Pred is a reference to a pointer (2-levels of indirection) and NIL is a global constand defined as an int == -1 (no re-direction). You can not compare pointers to integers without some sort of de-referencing occuring on the pointer.

Ok so I have managed to get through the compile and linker without errors. However now I am getting a segmentation fault. I have attached my code below. The break is coming from my insert function according to the debugger, but I dont know how to remidie the problem. I have attached the code (with the break annotated) and the data file I am using.

Code:

//Assignment 8
//Linked Lists
//Pointer Variable Implementation
//Devang Joshi

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <fstream>
using namespace std;

//*************************************************************************************************  
      				                   /* Global Variables */    
//*************************************************************************************************
 
    const int NAMESIZE=25;
    const int FILENAME=51;
    const int MAXLISTSIZE=200;       
  
    typedef char Name_t[NAMESIZE];
    typedef char Filename_t[FILENAME];
    typedef int ID_t;
    typedef double Bal_t;
    typedef fstream Infile_t;
    typedef fstream Outfile_t;
    const int NIL=-1; 
 
      
//*************************************************************************************************
      				               /* Class Declerations */   
//*************************************************************************************************

    class cAccount
    {
		private:
			
			Name_t fname;
      		Name_t lname;
      		ID_t aID;
      		Bal_t aBal;       

      	public:       

      		cAccount();                       
      		void Read (Infile_t &Infile);     
      		void Print (Outfile_t &Outfile);  
      		void Display();                   
      	    int compID2ID(cAccount NewAccount);      		   

      };// end cAccount       
//*************************************************************************************************
      				              /* Struct Declerations */
//*************************************************************************************************
 
      struct LLEle_t
      {
	      cAccount Account;
      	  LLEle_t * Link; 

      };// end ListEle_t     
//*************************************************************************************************
				                   /* Link Decleration */ 
//*************************************************************************************************

      typedef LLEle_t * Link_t;      

//*************************************************************************************************
      			             /* Class Function Implementations */       
//*************************************************************************************************
      cAccount::cAccount()
      {
		  strcpy(fname,"");
      	  strcpy(lname,"");                                                
      	  aID=0;
      	  aBal=0;  
	  
	  }// end cAccount::cAccount       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 
      void cAccount::Read(Infile_t &Infile)
	  { Infile>>aID>>lname>>fname>>aBal;}// end cAccount::Read              
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Print(Outfile_t &Outfile)  
      {
	      Outfile<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl; 
      	  Outfile<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;      
      	  Outfile<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl; 
      	  Outfile<<"------------------------------------------------"<<endl;  
  
	  }// end cAccount::Print           
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Display()
      {
	      cout<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl;
      	  cout<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;        
      	  cout<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl;
      	  cout<<"------------------------------------------------"<<endl;       
 
      }// end cAccount::Display       
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      int cAccount::compID2ID(cAccount NewAccount)
      {
		  int count;
      	  count=0;       

      	  if(this->aID > NewAccount.aID)
      	  { count=-1;}// end if     

	      else if(this->aID < NewAccount.aID)       
      	  { count=1; }// end else if       

		  else
      	  { count=0;}//end else       

      	  return count;

      }// end cAccount::compID2ID    
//*************************************************************************************************
      				                   /* Function Prototypes */
//*************************************************************************************************
 
      void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount,LLEle_t * Link); 
      void Search4Pred(Link_t &Pred,Link_t List,Link_t Start, cAccount Account);  
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount,LLEle_t *Link);  
      void Load(Link_t &Start,Link_t &Avail,LLEle_t * Link);  
      void Display(Link_t Start, Link_t Avail);
      void Print(Link_t Start,Link_t Avail);   
      
//*************************************************************************************************
      					                       /* MAIN */       
//*************************************************************************************************

      int main()
      {
		  int COUNT=0; 
      	  Link_t Start=0; 
      	  Link_t Avail=0;
		  LLEle_t * Link=NULL;
      	  cAccount Account;
      	  Infile_t Infile;

          /* FUNCTION CALLS */

      	  Load(Start,Avail,Link);
      	  Display(Start,Avail);
      	  Print(Start,Avail);
      	  
      	  return 0;

      }// end main 
//************************************************************************************************* 
      				               /* Function Implementations */   
//*************************************************************************************************
      void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount,LLEle_t * Link)
      {
          Link_t Curr;
      	  Curr=Link;					
      	  Curr->Account=NewAccount;    //breaks here   
 
      	  if(Pred!=NULL)
      	  {
		      Curr->Link=Pred->Link;        
      		  Pred->Link=Curr;
      	  }    
	      else
      	  {
      		  Curr->Link = Start;
      		  Start = Curr;
      	  }

      };// end Insert       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Search4Pred(Link_t &Pred,Link_t Start, cAccount Account)
      {
	      bool Done=false; 
      	  Link_t Curr;
      	  Curr=Start;
      	  Pred=NULL;       

     	  while((Done!=true)&&(Curr!=NULL))
      	  {
			  if(Curr->Account.compID2ID(Account)>0)   
      		  {
			      Pred=Curr;
      			  Curr=Pred->Link;
      		  }
      		  else
      		  { Done=true;}
      	  }//end while
      }// end Search4Pred       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount,LLEle_t *Link)
      {
	      Link_t Pred;

      	  Search4Pred(Pred,Start,NewAccount);               
      	  Insert(Start,Pred,Avail,NewAccount,Link);

	  }// end Add       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Load(Link_t &Start,Link_t &Avail,LLEle_t * Link)
      {
	      Filename_t Filename;
      	  Infile_t Infile;
      	  Link_t Curr=0; 
      	  Link_t Pred=0; 
	      cout<<"Program Starting.........."<<endl;
      	  cout<<"Begining Load.........."<<endl<<endl;
      	  cout<<"Enter the name of the data file to be used:"<<endl;  
      	  cin>>Filename;
      	  Infile.open(Filename,ios::in);
      	  cAccount NewAccount; 
      	  NewAccount.Read(Infile);
      	  while(!Infile.eof())
      	  {
		      Add(Avail,Start,NewAccount,Link);
      		  NewAccount.Read(Infile);

      	  }//end while
 
      	  Infile.close();
      	  cout<<"Read Complete........."<<endl;
	      cout<<"Load Complete........."<<endl;

      };//end load
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Display(Link_t Start, Link_t Avail)
      {
	      Link_t Curr;
      	  Curr=Start;
      	  Name_t choice;
      	  cout<<"Would you like to view the output file?"<<endl;
      	  cout<<"(YES or NO)"<<endl;
      	  cin>>choice;

      	  if(strcmp(choice,"YES")==0||strcmp(choice,"Yes")==0||strcmp(choice,"yes")==0) 
      	  {
			  cout<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;       

      		  while(Curr!=NULL)                                             
      		  {
			      Curr->Account.Display();
      			  Curr=Curr->Link;

      		  }//end while

			  cout<<endl;
			  cout<<"Moving to next process.........."<<endl<<endl;

      	  }//end if
      	  else
      	  {
		      cout<<"Very Well.........."<<endl;
		      cout<<"Moving to next process.........."<<endl<<endl;
      	  }

      };// end Display
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Print(Link_t Start,Link_t Avail)
	  {
	      Link_t Curr;
      	  Curr=Start; 
      	  Filename_t Filename;
      	  Outfile_t Outfile;
      	  cout<<"Enter the name of the output file: "<<endl;
      	  cin>>Filename; 
      	  Outfile.open(Filename,ios::out);
      	  Outfile<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;

      	  while(Curr!=NULL)
      	  {
			  Curr->Account.Print(Outfile);
      		  Curr=Curr->Link;

      	  }//end while       

      	  Outfile.close();
      	  cout<<"Write Sucessful.........."<<endl<<endl;

      };// end Print
//*************************************************************************************************
				                   /* END OF SOURCE CODE */
//*************************************************************************************************

data:

31951
Walker
John
1000.98
69537  
Patton  
George
876.07
28542
Colt
Samuel 
1234.56
28325
Bond
James
6798.00
68128 
Hamilton  
Alex
9000.00
44206
Lincoln
Abe
00.01 
13108
Armstrong
Louis  
750.00 
41727
Gotti
John
5500.60
21158
Lennon
John
6969.69 
52019
McCarthy
Joseph
742.02
37823 
Stewart  
Jon 
29.98 
70109  
Schrute  
Dwight 
00.00
74746  
Bob
Billy
50.50
18211
Pitt
Brad
2056.89
19724
Blitzer
Wolf
3009.10 
49926  
Dillinger 
John
862.43

It looks like you need to define an overloaded assignment operator for your cAccount class. The compiler probably didn't implement its default copy constructor correctly for your class.

Edited 6 Years Ago by Fbody: n/a

what does that mean?

does that mean I should do something like this

Curr->Account=this->NewAccount;

ok I have made it past the segmentation fault and the program can run now, except, it does not print any of the data from the data files just the headings.

Also thanks for being patient and helping me

Here is the new code:

//Assignment 8
//Linked Lists
//Pointer Variable Implementation
//Devang Joshi

#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>
#include <fstream>
using namespace std;

//*************************************************************************************************  
      				                   /* Global Variables */    
//*************************************************************************************************
 
    const int NAMESIZE=25;
    const int FILENAME=51;
    const int MAXLISTSIZE=200;       
  
    typedef char Name_t[NAMESIZE];
    typedef char Filename_t[FILENAME];
    typedef int ID_t;
    typedef double Bal_t;
    typedef fstream Infile_t;
    typedef fstream Outfile_t;
    int NIL=-1; 
 
      
//*************************************************************************************************
      				               /* Class Declerations */   
//*************************************************************************************************

    class cAccount
    {
		private:
			
			Name_t fname;
      		Name_t lname;
      		ID_t aID;
      		Bal_t aBal;       

      	public:       

      		cAccount();                       
      		void Read (Infile_t &Infile);     
      		void Print (Outfile_t &Outfile);  
      		void Display();                   
      	    int compID2ID(cAccount NewAccount);      		   

      };// end cAccount       
//*************************************************************************************************
      				              /* Struct Declerations */
//*************************************************************************************************
 
      struct LLEle_t
      {
	      cAccount Account;
      	  LLEle_t * Link; 

      };// end ListEle_t     
//*************************************************************************************************
				                   /* Link Decleration */ 
//*************************************************************************************************

      typedef LLEle_t * Link_t;      

//*************************************************************************************************
      			             /* Class Function Implementations */       
//*************************************************************************************************
      cAccount::cAccount()
      {
		  strcpy(fname,"");
      	  strcpy(lname,"");                                                
      	  aID=0;
      	  aBal=0;  
	  
	  }// end cAccount::cAccount       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- 
      void cAccount::Read(Infile_t &Infile)
	  { Infile>>aID>>lname>>fname>>aBal;}// end cAccount::Read              
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Print(Outfile_t &Outfile)  
      {
	      Outfile<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl; 
      	  Outfile<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;      
      	  Outfile<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl; 
      	  Outfile<<"------------------------------------------------"<<endl;  
  
	  }// end cAccount::Print           
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void cAccount::Display()
      {
	      cout<<setw(10)<<"ACCOUNT-ID: "<<aID<<endl;
      	  cout<<setw(10)<<"ACCOUNT NAME: "<<lname<<","<<fname<<endl;        
      	  cout<<setw(10)<<"ACCOUNT BALANCE: $"<<aBal<<endl;
      	  cout<<"------------------------------------------------"<<endl;       
 
      }// end cAccount::Display       
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      int cAccount::compID2ID(cAccount NewAccount)
      {
		  int count;
      	  count=0;       

      	  if(this->aID > NewAccount.aID)
      	  { count=-1;}// end if     

	      else if(this->aID < NewAccount.aID)       
      	  { count=1; }// end else if       

		  else
      	  { count=0;}//end else       

      	  return count;

      }// end cAccount::compID2ID    
//*************************************************************************************************
      				                   /* Function Prototypes */
//*************************************************************************************************
 
      void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount,LLEle_t * Link); 
      void Search4Pred(Link_t &Pred,Link_t List,Link_t Start, cAccount Account);  
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount,LLEle_t *Link);  
      void Load(Link_t &Start,Link_t &Avail,LLEle_t * Link);  
      void Display(Link_t Start, Link_t Avail);
      void Print(Link_t Start,Link_t Avail);   
      
//*************************************************************************************************
      					                       /* MAIN */       
//*************************************************************************************************

      int main()
      {
		  int COUNT=0; 
      	  Link_t Start=0; 
      	  Link_t Avail=0;
		  LLEle_t * Link=NULL;
      	  cAccount Account;
      	  Infile_t Infile;

          /* FUNCTION CALLS */

      	  Load(Start,Avail,Link);
      	  Display(Start,Avail);
      	  Print(Start,Avail);
      	  
      	  return 0;

      }// end main 
//************************************************************************************************* 
      				               /* Function Implementations */   
//*************************************************************************************************
      void Insert(Link_t &Head, Link_t &Pred,Link_t &Start,cAccount NewAccount,LLEle_t * Link)
      {
          Link_t Curr;
      	  Curr=new(LLEle_t);	
      	  Curr->Account=NewAccount;//<-----------breaks here   
 
      	  if(Pred!=NULL)
      	  {
		      Curr->Link=Pred->Link;        
      		  Pred->Link=Curr;
      	  }    
	      else
      	  {
      		  Curr->Link = Start;
      		  Start = Curr;
      	  }

      };// end Insert       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Search4Pred(Link_t &Pred,Link_t Start, cAccount Account)
      {
	      bool Done=false; 
      	  Link_t Curr;
      	  Curr=Start;
      	  Pred=NULL;       

     	  while((Done!=true)&&(Curr!=NULL))
      	  {
			  if(Curr->Account.compID2ID(Account)>0)   
      		  {
			      Pred=Curr;
      			  Curr=Pred->Link;
      		  }
      		  else
      		  { Done=true;}
      	  }//end while
      }// end Search4Pred       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Add(Link_t &Avail,Link_t &Start, cAccount NewAccount,LLEle_t *Link)
      {
	      Link_t Pred;

      	  Search4Pred(Pred,Start,NewAccount);               
      	  Insert(Start,Pred,Avail,NewAccount,Link);

	  }// end Add       
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Load(Link_t &Start,Link_t &Avail,LLEle_t * Link)
      {
	      Filename_t Filename;
      	  Infile_t Infile;
      	  Link_t Curr=0; 
      	  Link_t Pred=0; 
	      cout<<"Program Starting.........."<<endl;
      	  cout<<"Begining Load.........."<<endl<<endl;
      	  cout<<"Enter the name of the data file to be used:"<<endl;  
      	  cin>>Filename;
      	  Infile.open(Filename,ios::in);
      	  cAccount NewAccount; 
      	  NewAccount.Read(Infile);
      	  while(!Infile.eof())
      	  {
		      Add(Avail,Start,NewAccount,Link);
      		  NewAccount.Read(Infile);

      	  }//end while
 
      	  Infile.close();
      	  cout<<"Read Complete........."<<endl;
	      cout<<"Load Complete........."<<endl;

      };//end load
 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Display(Link_t Start, Link_t Avail)
      {
	      Link_t Curr;
      	  Curr=Start;
      	  Name_t choice;
      	  cout<<"Would you like to view the output file?"<<endl;
      	  cout<<"(YES or NO)"<<endl;
      	  cin>>choice;

      	  if(strcmp(choice,"YES")==0||strcmp(choice,"Yes")==0||strcmp(choice,"yes")==0) 
      	  {
			  cout<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;       

      		  while(Curr!=NULL)                                             
      		  {
			      Curr->Account.Display();
      			  Curr=Curr->Link;

      		  }//end while

			  cout<<endl;
			  cout<<"Moving to next process.........."<<endl<<endl;

      	  }//end if
      	  else
      	  {
		      cout<<"Very Well.........."<<endl;
		      cout<<"Moving to next process.........."<<endl<<endl;
      	  }

      };// end Display
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      void Print(Link_t Start,Link_t Avail)
	  {
	      Link_t Curr;
      	  Curr=Start; 
      	  Filename_t Filename;
      	  Outfile_t Outfile;
      	  cout<<"Enter the name of the output file: "<<endl;
      	  cin>>Filename; 
      	  Outfile.open(Filename,ios::out);
      	  Outfile<<setw(20)<<"ACCOUNT-DATA"<<endl<<endl;

      	  while(Curr!=NULL)
      	  {
			  Curr->Account.Print(Outfile);
      		  Curr=Curr->Link;

      	  }//end while       

      	  Outfile.close();
      	  cout<<"Write Sucessful.........."<<endl<<endl;

      };// end Print
//*************************************************************************************************
				                   /* END OF SOURCE CODE */
//*************************************************************************************************
This article has been dead for over six months. Start a new discussion instead.