Question

Write a small program that allows the entry and display of client details, including a client...

Write a small program that allows the entry and display of client details, including a client number, name, address, telephone number, preferred number of rooms, and maximum rent. The details should be stored in a file. Enter a few records and display the details. (Please write the program in C++ and offer comments if possible, Thanks)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
int num,cli_num,num_rooms;
long long int max_rent,tel_num;
string name,address;
ofstream MyFile("details.txt"); //enter the path to store the details
cout<<"Enter number of records you want to store:"; //number of clients to be stored
cin>>num;
while(num>0) //loop iterates num times
{
cout<<"Enter client number:";
cin>>cli_num;
cout<<"Enter client name:";
cin>>name;
cout<<"Enter address:";
cin>>address;
cout<<"Enter telephone number:";
cin>>tel_num;
cout<<"Enter prefered number of rooms:";
cin>>num_rooms;
cout<<"Enter rent:";
cin>>max_rent;
//stores data into file
MyFile << "client number="<<cli_num<<" name="<<name<<" address="<<address<<" telephone num="<<tel_num<<" prefered num of rooms="<<num_rooms<<" rent="<<max_rent<<"\n";
//displaying on to the screen
cout<<"client number="<<cli_num<<" name="<<name<<" address="<<address<<" telephone num="<<tel_num<<" prefered num of rooms="<<num_rooms<<" rent="<<max_rent<<"\n";
num--;
  
}
MyFile.close(); //closing file
return 0;
}

//check the snips for any doubts

OUTPUT:

details.txt://details stored into details.txt

Add a comment
Know the answer?
Add Answer to:
Write a small program that allows the entry and display of client details, including a client...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C++ Write a program that allows the user to enter eight integer values. Display the...

    In C++ Write a program that allows the user to enter eight integer values. Display the values in the reverse order of the order they were entered. Name the file ReverseNumbers.cpp.

  • Serendipity Engineering, Inc. Software Development Project Program Specifications: Serendipity Engineering, Inc. is a small engineering company...

    Serendipity Engineering, Inc. Software Development Project Program Specifications: Serendipity Engineering, Inc. is a small engineering company located in a commercial park. The project manager wants you to develop a customer software package that will allow the company enter the customer information in the computer to keep a customer database. The software will perform the following tasks using menus: Enter Customer Information Display Customer Information Search Customer Information Organize (Sort) Customer Information Add, Delete, Modify, and Look Up Customer Records Save...

  • Write a Java program that creates and manipulates a directory of names, telephone numbers. The following...

    Write a Java program that creates and manipulates a directory of names, telephone numbers. The following information will be stored for each person in the directory: - Name (Last, First) - Home telephone number You should keep the entire collection ordered by key value (the combination of last and first names). Your program should be able to perform the following basic functions: - Search and display the contents of a particular entry - Display the entire directory - Delete an...

  • Write a contacts database program that presents the user with a menu that allows the user...

    Write a contacts database program that presents the user with a menu that allows the user to select between the following options: (In Java) Save a contact. Search for a contact. Print all contacts out to the screen. Quit If the user selects the first option, the user is prompted to enter a person's name and phone number which will get saved at the end of a file named contacts.txt. If the user selects the second option, the program prompts...

  • In C++ 1. Write a program that allows a user to enter 10 integer values from...

    In C++ 1. Write a program that allows a user to enter 10 integer values from the keyboard. The values should be stored in an array. 2. The program should then ask the user for a number to search for in the array: The program should use a binary search to determine if the number exists in a list of values that are stored in an array (from Step #1). If the user enters a number that is in the...

  • Write a program that takes a .txt file with movie details. First entry is the year...

    Write a program that takes a .txt file with movie details. First entry is the year of the movie, second is the name of the movie, third is the name of the actor and fourth is the rating of the genre of the movie. These are all seperated by a period. Need to have features, searching the movie based on the title of the movie, year of movie and genre of the movie. (need to have classes for the features)...

  • Write a Python program to create userids: You work for a small company that keeps the...

    Write a Python program to create userids: You work for a small company that keeps the following information about its clients: • first name • last name • a user code assigned by your company. The information is stored in a file clients.txt with the information for each client on one line (last name first), with commas between the parts. In the clients.txt file is: Jones, Sally,00345 Lin,Nenya,00548 Fule,A,00000 Your job is to create a program assign usernames for a...

  • Customer Accounts This program should be designed and written by a team of students. Here are...

    Customer Accounts This program should be designed and written by a team of students. Here are some suggestions: Write a program that uses a structure to store the following information about a customer account: • Name • Address • City, state, and ZIP • Telephone number • Account balance • Date of last payment The structure should be used to store customer account records in a file. The program should have a menu that lets the user perform the following...

  • Using network sockets, write a C program called client that receives three command-line arguments in the...

    Using network sockets, write a C program called client that receives three command-line arguments in the form: client host port file and sends a request to a web server. The command-line arguments are hostRepresents the web server to connect to port Represents the port number where a request is sent. Normally an HTTP request is sent over port 80, but this format allows for custom ports file Represents the file requested from the web server Your program should create a...

  • Write the code to maintain a list of student records. The main flow of your program...

    Write the code to maintain a list of student records. The main flow of your program should be to read all information from file(s) and place it in arrays, loop and do stuff with the records (e.g., add, update, look up, etc.), before exiting optionally write the new information back to the file(s) before exiting. Please note the files are only accessed at the beginning and the end, do not change the files during the "do stuff loop" (unless you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT