0% found this document useful (0 votes)
85 views2 pages

Source Code: Task 6

The document describes a C++ program to store customer bank account information including name, account number, and balance for 50 customers. It includes functions to: 1) Print the names of customers with a balance less than $200 2) Add $100 to the balance of customers with over $1000 and print the new balance The program defines a struct called "bank" to store the customer data, initializes an array of 50 "bank" structs to input customer information, then calls the functions to output names of customers with low balances and increment balances over $1000.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views2 pages

Source Code: Task 6

The document describes a C++ program to store customer bank account information including name, account number, and balance for 50 customers. It includes functions to: 1) Print the names of customers with a balance less than $200 2) Add $100 to the balance of customers with over $1000 and print the new balance The program defines a struct called "bank" to store the customer data, initializes an array of 50 "bank" structs to input customer information, then calls the functions to output names of customers with low balances and increment balances over $1000.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Task 6

Write a structure to store the name, account number and balance of 50 customers and store
their information.
1 - Write a function to print the names of all the customers having balance less than $200.
2 - Write a function to add $100 in the balance of all the customers having more than $1000
in their balance and then print the incremented value of their balance.

Source code
#include<iostream>
#include<string>
using namespace std;

struct bank
{
public:
int acc;
string name;
float balance;
void Display()
{
cout << "Name::" << endl << name << endl;
cout << "Account Number::" << endl << acc << endl;
cout << "Balance::" << endl << balance << endl;
}

void show() // for customers having less than 200 balance


{
if (balance < 200)
{
cout << "Name :" << endl << name << endl;
cout << "Account Number :" << endl << acc << endl;
cout << "Balance :\n" << balance << endl;
}
}

void add_balance()
{
if (balance > 1000)
{
balance = balance + 100;
Display();
}
}
};

int main()
{
bank person[50];
for (int i = 0; i < 50; i++)
{
cout << "Enter Name: :\n";
cin.ignore();
getline(cin, person[i].name);

cout << "Enterr Account Number: :\n";


cin >> person[i].acc;
cout << "Enter Balance: :\n";
cin >> person[i].balance;
}
system("cls");
cout << " -----------------------------------------
" << endl;
cout << "People with Balance less than $200 in their account" << endl;
cout << " -----------------------------------------
" << endl;
for (int j = 0; j < 50; j++)
{
person[j].show();
}
cout << " -----------------------------------------
" << endl;
cout << "Adding $100 in accounts having more than $1000" << endl;
cout << " -----------------------------------------
" << endl;
for (int k = 0; k < 50; k++)
{
person[k].add_balance();

system("pause");
return 0;
}

You might also like