program5 - /*/ /Item Points Actual / Possible Points...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/******************************************************************************/ //Item Points Actual // Possible Points //Pasting this table in your writeup 1 //Your name 1 //Description 1 //Function Comments 5 //(parameters, pre/post conditions, //descriptions) / //Variable comments 2 //Use of functions 4 //Display menu 4 //Read in from File 7 //Write to File 7 //Search 7 //Add 4 //Delete 4 //3 test cases 3 /******************************************************************************/ / // Tom Nanke // CIS 150-001 // 12-11-07 // Program 5 // This is a computer rolodex program. It stores the information of people on // cards. This information includes their last name, followed by their first // name, then their phone number, and lastly their email address. The program // allows you to read in the card info from a file, write that info to another // file, add a card to the list, delete a card, and search for a card by last // name. Expected input would be the user's decision of which action to take, // followed by any information he/she is prompted for. Expected output would be // for the computer to perform whichever action the user wants performed. When // the user chooses to print the rolodex onto the screen, the computer should // successfully output the card information. / #include<iostream> #include<string> #include<fstream> using namespace std; u struct person //this structure contains the information of a person { //that will be stored on each card int cardCount; //a count of how many cards there are string lastName; //variable represents the last name of the person
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
string firstName; //variable represents the first name of the person string phone; //variable represents the phone # of the person string email; //variable represents the email address of the person }; } class Cards //a class named Cards will be used { public: int cardCount; //a count of how many cards there are Cards(); //constructor void Add(person card[], person newCard); //function prototype void Delete(person card[], person newCard); //function prototype void Search(person card[], person newCard); //function prototype }; } Cards::Cards() //this constructor initializes the cardCount to 0 { cardCount=0; } void Cards::Add(person card[], person newCard) {//adds a new card to the list //parameters are an array of structs, which are the cards, and a single //struct, which is the card the user wants to add //pre-cond:array not full //post-cond:cardCount is incremented by 1 because a new card was added cardCount=card[24].cardCount; //an explanation of using 24 here is card[cardCount].lastName=newCard.lastName;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

program5 - /*/ /Item Points Actual / Possible Points...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online