help me out it says in fuction int main, expected primary expression,,

#include <iostream>
#include <stdlib.h>
using namespace std;
#define n_file 5
struct record_t
{
 char accname[50];
 int accnum;
 int intbal;
 int ctbal;
 int deposits;
 int deposit;
}
accounts[n_file];
void printbankaccounts(record_t record);
void displayctbal(record_t record);
int main()
{
 char buffer[50];
 int i,trans,result;
 for(i=0;i<n_file;i++)
 {
  cout<<"enter account name:";
  cin.getline(accounts[i].accname,50);
  cout<<"enter account number:";
  cin.getline(buffer,50);
  accounts[i].accnum=atoi(buffer);
  cout<<"enter intial balance:";
  cin.getline(buffer,50);
  accounts[i].intbal=atoi(buffer);
 }
  cout<<"\nyou have entered these accounts\n";
  for(i=0;i<n_file;i++)
  printbankaccounts(accounts[i]);
  cout<<"[1]-deposits";
  cout<<"[2]-withdraws";
  cout<<"[3]-check balance";
  cout<<"select transaction";
  cin>>trans;
  switch(trans)
  {
    case 1:
              for(i=0;i<n_file;i++)
              cout<<"enter deposit ammount";
              cin.getline(buffer,50);
              accounts[i].deposit=atoi(buffer);
              displayctbal(record_t record);

}          
  return 0;
  }

 void printbankaccounts(record_t record)
 {
    cout<<record.accname;
    cout<<"("<<record.accnum<<")\n";
    cout<<"("<<record.intbal<<")\n";
 }

 void displayctbal(record_t record)
 {
  int i;
  for(i=0;i<n_file;i++)
  {
   accounts[i].deposits=accounts[i].intbal+accounts[i].deposit;
   accounts[i].ctbal=accounts[i].deposits;
   cout<<record.accname;
   cout<<"("<<record.ctbal<<")\n";
  }
 }

It's been awhile since I've worked with C++, but I believe you need a semicolon at the end of your structure declaration. Line 13 should look like this: "};"

Hey lizziekadango,

I tried to compile your code and I get a bunch of errors. Your struct should end with a semicolon, I don't get what you're trying to do when you pass the struct name in the void printbankaccounts(record_t record); function etc...!

struct name must not end with a semi colon

Change this on line 47

displayctbal(record_t record);

to this

displayctbal(accounts[i]);
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.