Write a program in c++ that ask a user for following information AgentID an Int Price a float HouseType a string write the information to a file named AgentComission.txt and then read that information from file and display it on screen.
#include<iostream>
#include<fstream>
using namespace std;
int main() {
ofstream outputFile;
outputFile.open ("AgentComission.txt");
int AgentID ;
float Price ;
string HouseType ;
cout<<"Enter the AgentID: ";
cin >> AgentID;
cout<<"Enter the Price: ";
cin >> Price;
cout<<"Enter the HouseType: ";
cin >> HouseType;
outputFile<<AgentID<<"\t"<<Price<<"\t"<<HouseType;
cout<<"File has been generated"<<endl;
outputFile.close();
ifstream inputFile;
inputFile.open("AgentComission.txt");
cout<<"Reading file contents from a file"<<endl;
if (inputFile.is_open()) {
while (!inputFile.eof()) {
inputFile >> AgentID>>Price>>HouseType;
cout<<"AgentID: "<<AgentID <<endl;
cout<<"Price: "<<Price <<endl;
cout<<"HouseType: "<<HouseType <<endl;
}
}
outputFile.close();
inputFile.close();
return 0;
}
Output:
sh-4.2$ g++ -o main *.cpp
sh-4.2$ main
Enter the AgentID: 2222
Enter the Price: 5000
Enter the HouseType: Residentials
File has been generated
Reading file contents from a file
AgentID: 2222
Price: 5000
HouseType: Residentials
Write a program in c++ that ask a user for following information AgentID an Int Price...
Write a complete C++ program to ask the user to inter two
integers and the program finds and display the greatest common
divisor (GCD) of the two integers. Typical output screen should be
as following:
Write a complete C++ program to ask the user to inter two integers and the program finds and display the greatest common divisor (GCD) of the two integers. Typical output screen should be as following: Enter two integers 18 27 The GCD is = 9
Write program in C. Please ask the user to determine how many numbers to enter, and then find and display the largest one with two digits. Please call the following two functions in your main functions. void input_numbers(float *data, int num); void find_largest(float *data, int num); Note: In this assignment, please save the entered numbers using pointer, pass the pointer as the arguments. Depending upon the number of elements, the required size is allocated which prevents the wastage of memory....
Write a complete C++ program to ask the user to inter two
integers and the program finds and display the greatest common
divisor (GCD) of the two integers. Typical output screen should be
as following:
Enter two integers 18 27 The GCD is = 9
Develop a system flowchart and then write a menu-driven C++ program that uses user-defined functions arrays, and a random number generator. Upon program execution, the screen will be cleared and the menu shown below will appear at the top of the screen and centered. The menu items are explained below. Help Smallest Quit H or h ( for Help ) option will invoke a function named help() which will display a help screen. The help screen(s) should guide 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...
3. Write a C# program that perform the following operations (30 points) (1) ask the user to input a string (2) find out the length of the string (3) convert the string into lowercase (5) Display the string by applying PadLeft
Write the program in C
The following statistics for cities of the Vege country are stored in a file: Name: a string of characters less than 15 characters long. Population: an integer value. Area: square miles of type double Write a program that: asks and gets the name of the input file from the user. Read the contents of the file into an array length 10 of structures -ask the user for the name of a city (less than 15...
Write a program that displays a menu on the screen. The menu will give the user four options - enter two integers, enter two decimal numbers (#.#), enter one integer and one decimal number, or quit. The inputs should be labelled a, b, c, or d, and you should enter in the letter to choose the appropriate option. Once the user selects the option, two numbers will be read in from the user. The numbers will be added together and...
Write a C program that prompts the user to enter a binary value, multiplies it by ten, then displays the result in binary. (“Binary” here means that the user communicates with the program in ones and zeros.) Your main function should a) declare a char array, b) call the readLn function to read from the keyboard c) call a function to convert the input text string to an int d) multiply the int by ten e) call a function to...