Need help reading data from a file that looks like this:
This file may be longer than this or shorter (it's an example). I have to create a menu driven code that will open a file that looks like that and give me menu options for each name. It's a telemarketer's program that will determine what interest rate will be given to each customer based on if they are preferred or not (That's the X, A, ! characters you see in the file above).Code:X Joe Scholtz 437-4798 A Tim Wade 768-7658 X Sara Jobs 326-7857 ! Jaynce Bee 354-8678
Trying to make a telemarketer's program that will first open a file in this format: status code (one letter/symbol for approved, preferred, not, etc.), first name, last name, phone number (with dashes).
From there the program will display the name, phone number, status (preferred/not preferred), and what there available APR is based on if they are preferred or not.
Under this info will be a menu... press 1 to accept the card, 2 to transfer balance from another card, or 3 to decline card.
Anyway, need help creating these menus.This system must also allow for input of address info if the people accept the card. Then this file must write to a file saving the information.Code://This program is a telemarketing program that assists //the telemarketer by determining interest rate for each customer based on //preferred status and will collect data if they accept card #include <iostream> #include <fstream> #include <iomanip> using namespace std; int main() { ifstream inFile; char first[10], last[10], status [1], phone [8]; char street [25], city [15], zip [5]; inFile.open("a:\\credit.txt"); //error reporting if file is not located or cannot be opened. if (inFile.fail()) { cout<<"ERROR: Cannot open the file.\n"; return 0; } cout<<"File opened successfully."<<"\n\n"; cout<<"Reading Data from File."<<"\n\n"; cout<<setfill('-')<<setw(80)<<"-"<<endl; //Inputs first line of data inFile>>status; inFile>>first; inFile>>last; inFile>>phone; cout<<setfill('-')<<setw(80)<<"-"<<endl; //Close the file inFile.close(); cout<<"\nDone.\n\n"; return 0; }
Thanks for any help



LinkBack URL
About LinkBacks


