C++ comments would be nice, especially with \"Customers.dat\" part. Please don't use an already answered solution from chegg....

60.1K

Verified Solution

Question

Programming

C++

comments would be nice, especially with \"Customers.dat\"part.

Please don't use an already answered solution from chegg. I'veunfortunately had that happen at many occasions.

I'll most certainly upvote if program is right. I always do

......

......

Statement: Create a program that will loop andprompt to enter the highlighted data items in the structure below.This is every item except customerNumber , isDeleted andnewLine;


const int NAME_SIZE = 20;
const int STREET_SIZE = 30;
const int CITY_SIZE = 20;
const int STATE_CODE_SIZE = 3;

struct Customers {  long customerNumber;  char name[NAME_SIZE];  char streetAddress_1[STREET_SIZE];  char streetAddress_2[STREET_SIZE];  char city[CITY_SIZE];  char state[STATE_CODE_SIZE];  int zipCode;

    char isDeleted;
    char newLine;
};

Always set the item isDeleted to 'N' andnewline to '\n'. The item newLineis a convenient item that is there to assist in viewing thecontents of the file using \"type filename\" the cmd window.

Notepad will show the binary chars and will not line up the dataas expected. You may see some odd characters after the expecteddata for the character arrays. That is normal for C/C++.

The item customerNumber should start at 0 and increase by 1 forevery record written.


Once the data in the structure is loaded, write it to the file\"Customers.dat\" and prompt to continue. If the reply is to notcontinue, close the file and exit.

The file \"Customers.dat\" must be opened in Binary mode.
Deliverable is a working CPP program.

Answer & Explanation Solved by verified expert
3.7 Ratings (342 Votes)
C programincludeincludeincludeincludeincludeusing namespace stdconst int NAMESIZE 20const int    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students