In: Computer Science
C++ code
Output Formatting.
Design and implement a complete C++ program that reads a customer record from the user such as the record has 4 fields (pieces of information) as shown below:
Account Number (integer)
Customer full name (string)
Customer email (string)
Account Balance (double)
The program is expected to print the record in the format shown below:
Account Number : 0000000
Name : full name
Email : customer email
Balance : 000000.00$
For example, if the user enters the following record
1201077
Jonathan I. Maletic
10,000.17
The program outputs:
Account Number : 1201077
Name : Jonathan I. Maletic
Email : [email protected]
Balance : 10,000.17$
#include <iostream>
using namespace std;
int main() {
int accntNumber;
char name[100];
string email;
double balance;
cout<<"Enter account number : ";
cin>>accntNumber;
cout<<"Enter name " ;
cin.getline(name,sizeof(name));
cout<<"Enter name " ;
cin.getline(name,sizeof(name));
cout<<"Enter email Id: ";
cin>>email;
cout<<"Enter balance : ";
cin>>balance;
cout<<"Account Number : "<<accntNumber<<endl;
cout<<"Name\t: "<<name<<endl;
cout<<"Email\t: "<<email<<endl;
cout<<"Balance\t: "<<balance<<endl;
}
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me