win32....

the question is

 Open the file (CUSTOMERS) that maintains all the CUSTOMERS records.
 Ask the user to enter the required data Cust.Name, and then save it.
 Keep asking the user (Do you want to continue?) until he enters (N OR n)
Constraints:
 Cust.ID should be generated automatically.
 Avoid the duplication of Cust.Name.
*hey I want to know how to improve my program more so it can fit the exact constraints, and how to avoid the duplication of the cust.name*




#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
char choice;
string customer;
int cust_id=1001;

ofstream OF("CUSTOMERS.txt",ios::app);
do {
cout<<"ENTER A NEW CUSTOMER NAME:";
cin>>customer;
OF<<cust_id<<" "<<customer<<endl;
cust_id+=1;
cout<<"Do you want to continue Y/N ?";
cin>>choice;


}while(choice!='n');
OF.close();
return 0;

}
Please, do not doublepost. Other thread: http://www.cplusplus.com/forum/beginner/162843/
Topic archived. No new replies allowed.