Hi, I am having some problems with a program I'm supposed to write: here is the program I am supposed to write:
Write a modular 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 program should declare a structure variable. It should let the user enter information into the variable, change the contents of its members, and display all information stored in the structure. The program should have a menu-driven user interface.
Input Validation: When the information is entered, be sure the user enters data for all the fields. No negative account balances should be entered.
I've been trying to write the program with no success , I think I'm not calling the account structure correctly (account information)
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct account
{
string name; // Customer name
int address; // Address
int location; // City, state and zip.
int phone; // Phone number
float balance; // Account balance
int lastPayment; // last payment date
};
int main()
{
account information; // information is an account structure
// Get account information
cout << "Enter the name of the account holder: ";
cin >> information.name;
cout << "Enter the address: ";
cin.ignore();
getline(cin, information.address);
cout << "Enter your City, State, and Zip: ";
cin.ignore();
getline(cin, information.location);
cout << "Enter phone number: ";
cin >> information.phone;
cout << "Enter your account balance: ";
cin << information.balance;
cout << "When was your last payment date: ";
cin >> information.lastPayment;
// Display results
cout << "\n The customers account information:\n";
cout << "Name: " << information.name << endl;
cout << "address: " << information.address << endl;
cout << "City, State, Zip: " << information.location << endl;
cout << "phone number: " << information.phone << endl;
cout << "remaining balance: "<< information.balance << endl;
cout << "Date of last payment: " << information.lastPayment << endl;
return 0;
}
I would really appreciate it if someone can help me fix it... thanks again for the help.