1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
#include<iostream>
using namespace std;
#include<string.h>
struct bank {
char fullname[40];
long int hesab;
long int card;
long int mojudi;
};
void info(bank *);
long int searchhesab(bank A[], int, long int);
void bardasht(bank *, long int);
void enteghal(long int (*searchhesab) (bank A[], int n, long int x), bank *, long int, long int);
void soud(bank *);
int main()
{
int i, t, y;
long int B[i];
char d;
long int x, v, p, q;
bank B[10]
for (i = 0; i < 10; i++) {
info(&B[i]);
cout << "shomarehesab(16 number)";
cin >> x;
t = searchhesab(B, 10, x);
if (t == -1) {
cout << "shomarehesab not exist";
} else {
do {
cout << "what do you want to do 1-bardasht 2-soud&mojodi 3-enteghal";
cin >> y;
if (y == 1) {
bardasht(&B[t], v);
}
if (y == 2) {
soud(&B[t])
}
if (y == 3) {
enteghal(&B[t], p, q)
}
cout << "Are you need to continue? y/n ";
cin >> d;
} while (d == 'y');
}
}
return 0;
}
void info(bank * B)
{
cout << "enter fullname";
cin.get(B->fullname, 39);
cout << "enter shomarehesab";
cin >> B->hesab;
cout << "enter shomarecart";
cin >> B->card;
cout << "enter mojudi";
cin >> B->mojudi;
}
long int searchhesab(bank A[], int n, long int x)
{
int i;
for (i = 0; i < 10; i++) {
if (B[i]->hesab == x) {
return i;
}
}
return -1;
}
void bardasht(bank *, long int v)
{
long int w, z;
w = B[i]->mojudi;
cout << "how much do you need?";
cin >> v;
if (w > v) {
z = w - v;
cout << "mablagh bardashti=" << v;
} else {
cout << "mojudi is not enough";
}
}
void enteghal(long int (*searchhesab) (bank A[], int n, long int x), bank *, long int q, long int p)
{
long int r, a;
int u;
r = B[i]->mojudi;
cout << "money for transfer? ";
cin >> q;
a = r - q if (a > 0) {
cout << "shomare hesab maghsad";
cin >> p;
u = searchhesab(p);
if (u != -1) {
f = B[u]->mojudi;
cout << "mojudi baghimande" << "=" << a;
} else {
cout << "somare hesab not exsit";
}
} else {
cout << "mojudi is not enough";
}
}
void soud(bank *)
{
long int j, b;
double l = 0.1;
j = B[i]->mojudi b = j * l;
cout << "mojudi shoma ba 0.1 soud" << b;
}
|