السلام عليكــم ورحمـة الله وبركاتــه ،،
لو سمحتم يامبرمجينا العرب
ابي منكم خدمه الله يوفقكم وهي
عندي كود سويته مدري حاولت حست بس احس مو منطقي يعني تخربطت في الفقره رقم ثلاثه إن شاء الله مو صعب عليكم
السؤال كان
A bank needs to keep information about clients. For any client, an account number is issued before he/she is allowed to use bank services. The account number is generated automatically and once established it can’t be modified. In addition, name, contact number, amount, account type [golden or silvery] are kept in system.
Write a program to implement the following tasks:
1. Deposit money [increase money of current balance]
2. Withdraw money [decrease money of current balance]
3. Use non class member function which takes object/s as argument to compare two account type and return the account number of the client with golden account; if they are same, the account number of the oldest client will be returned. [Note that this function can access private data members of the class directly]
اما بالنسبه لحلي هو:
#include<iostream>
using namespace std;
class bank
{
private:
string name;
long contactnumber;
int amount;
enum type{golden,sliver};
const int accountnumber;
public:
static int ss=1234;
bank(int n,long s,int z,type t):accountnumber(ss)
{
name=n;
contactnumber=s;
amount=z;
t=golden;
ss++;
}
int Deposit_money(int m)
{
return amount+=m;
}
int Withdraw_money (int s)
{
if(amount>0)
{
amount-=s;
}
return amount;
}
friend string compare_two_account_type (bank b1,bank b2);
};
string compare_two_account_type (bank b1,bank b2)
{
if(b1.type==b2.type)
{
if(b1.accountnumber<b2.accountnumber)
{
return b1.account number;
}
else
return b2.accountnumber;
}
else if(b1.type==golden)
{
return b1.accountnumber;
}
return b2.accountnumber;
}
int main()
{
bank b("Aaa",6587567,80000,golden)
bank b2("Asm",8768688,897978,sliver)
b.Deposit_money(777);
b.Withdraw_money (550);
b.compare_two_account_type;
b2Deposit_money(777);
b2Withdraw_money (550);
b2compare_two_account_type;
return 0;
}:wacko: :wub: :blink: