Project Help

hi all.

Im not sure whether this is the correct forum to post in, but here goes.

I've been given my first year (uni) project c++, a pretty small one really. Problem is I have written a code, but I havent tested or debugged it (dont ask). Can someone check it and correct any errors I have made, and suggest anyways i can improve it further. Thanks in advanced. :slight_smile:

ps. Im not sure whether my program is actually doing the things the scenario wants me to do. I dont know whether Im on the right track so I have attached the scenario to this post, and if anyone could read the scenario and see if my code is the correct way forward etc.. Thanks.

#include <iostream>
#include <assert>
#include <fstream>
using namespace std ;
const int BOOKS_MAX = 5000

// OPEN/READ/PROCESS BOOKDATA FILE FUCTION
void openfile (int argc, char* argv[])
{
assert (argc >= 2) ;
ifstream accfile(argv[1]);
if ( !accfile )
{
cerr << "File " << argv[1] << " not found\n" ;
exit(1) ;
}
int books = 0;
books a ;
accfile >> a.name >> a.booktitle >> a.booktype >> a.ID >> a.Taken ;
account accs[BOOKS_MAX] ;
int read = 0
//Read data file
do
{
accfile >> accs[read].name
>> accs[read].booktitle
>> accs[read].booktype
>> accs[read].ID ;
>> accs[read].Taken
if (accfile)
{
read++ ;
}
} while (accfile && read < BOOKS_MAX) ;
cout << read << " Books read\n " ;
accfile.close() ;
// Begin proccess
for (int i = 0; i < read; i++)
{
if (accs[i].booktitle == input && accs[i].Taken = 0
{
cout << accs.booktitle << "This book is currently unavailable " ;
exit (0) ;
}
else
{
cout << accs[i].booktitle << "This book is Available " ;
}
}
cout << "To loan this book please press 1, otherwise, to exit press 9\n " ;
int issue = 0 ;
cin >> issue ;
if (issue == 1)
{
ofstream oaccfile( argv[1] ) ;
for (int i = 0; i < read; i++)
{
oaccfile << accs[i].taken = 0 << endl ;
}
oaccfile.close();
}
else
{
if (issue == 9)
{
exit(0);
}
}

// OPEN USERDATA FILE FUNCTION
void user (int argc, char* argv[])
{
assert (argc >= 2) ;
ifstream accfile(argv[1]);
if ( !accfile )
{
cerr << "File " << argv[1] << " not found\n" ;
exit(1) ;
}
int accounts = 0 ;
accounts a;
accfile >> a.name >> a.street >> a.ID >> a.Bookstaken ;
int USER = 1000 ;
account accs[USER] ;
int readn = 0 ;
//Read data file
do
{
accfile >> accs[readn].name
>> accs[readn].street
>> accs[readn].ID
>> accs[readn].Bookstaken ;
if (accfile)
{
readn++ ;
}
} while (accfile && read < USER) ;
cout << readn << " acccounts read\n " ;
accfile.close() ;

// Input
int main()
{
cout << "Welcome\n " << "Please choose from one of the following options\n " << "To Search for a book press 1\n To Return a book press 2\n To exit Press 3 "
int a = 0 ;
cin >> a ;
if (cin == 0)
{
exit(0);
}
else {
if (cin = 1)
{
cout << "Please enter a book title " ;
cin >> input ;
openfile (input) ;
exit(0) ;
}
else (
if (cin = 2)
{
//WRITE CODE HERE FOR BOOK RETURN
}
}

Please make sure that you have read our rules. And note:
(6) Do not post classroom or homework problems.