شبیه سازی سیستم بانک

صفحه اصلی کارگروهها >> برنامه نویسی با ++C  >> شبیه سازی سیستم بانک
anita jojo

anita jojo

در کارگروه: برنامه نویسی با ++C
تعداد ارسالي: 2
14 سال پیش در تاریخ: دوشنبه, تير 21, 1389 9:49

سلام دوستای گلم .
من یه برنامه دارم مینویسم که میخوام کار یک بانک رو شبیه سازی کنم ، میخواستم 2 مشتری به عنوان پیش فرض توی بانک باشند که اطلاعات زیر رو داشته باشند :
1.نام و نام خانوادگی
2.شماره حساب
3.موجودی حساب
تا اینجای برنامه کد زیرو نوشتم ، مشکلی که دارم اینه که نمیتونم برای مشتری نام و نام خانوادگی تعیین کنم error زیرو میده :
error C2440: '=' : cannot convert from 'const char [6]' to 'char'
error C2440: '=' : cannot convert from 'const char [8]' to 'char'
اگه ممکنه بگین چیکار کنم تا error نده و اسم مشتری رو بزارم .

#include <iostream.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
struct Bank
{
string FirstName;
string LastName;
long ShomareHesab;
long MojudieHesab;
Bank *Next;
}
Moshtari1,Moshtari2,Moshtari3,Moshtari4,Moshtari5, Account;
Bank *First = NULL,*Last = NULL;
Bank *P = NULL;
int Menu();
void AddList();
void Info();
void AddMoshtari();
void DelMoshtari();
void AddPul();
void DellPul();
void Update();
void main()
{
AddList();
while(true)
{
switch(Menu())
{
case '1': Info();
break;
case '2': AddMoshtari();
break;
case '3': DelMoshtari();
break;
case '4': AddPul();
break;
case '5': DellPul();
break;
case '6': Update();
break;
case '0': exit(0);
}
}
}

int Menu()
{
char Input;
do
{
system("cls");
cout <<"Enter The Option Of Following Transuction:"<<endl;
cout << "1.Elane Vaziate Hesab:"<<endl;
cout << "2.Afzodane Hesab:"<<endl;
cout << "3.Bastane Hesab:"<<endl;
cout << "4.Varize Pul:"<<endl;
cout << "5.Bardashte Pul:"<<endl;
cout << "6.Beroz Resani Etelaate Yek Shakhs:"<<endl;
cout << "0.EXIT"<<endl;
cin >> Input;
}
while(!strchr("1234560",Input));
return Input;
}

void AddList()
{
Moshtari1.FirstName = "hossein";
Moshtari1.LastName = "hatamiyan";
Moshtari1.ShomareHesab = 1;
Moshtari1.MojudieHesab = 1500000;
First = Last = &Moshtari1;

Moshtari2.FirstName ="ali";
Moshtari2.LastName ="shakiba";
Moshtari2.ShomareHesab =2;
Moshtari2.MojudieHesab =500000;
Last->Next = &Moshtari2;
Last = &Moshtari2;

Moshtari3.FirstName ="amin";
Moshtari3.LastName ="shakeri";
Moshtari3.ShomareHesab =3;
Moshtari3.MojudieHesab =2500000;
Last->Next = &Moshtari3;
Last = &Moshtari3;

Moshtari4.FirstName ="mina";
Moshtari4.LastName ="sadri";
Moshtari4.ShomareHesab =4;
Moshtari4.MojudieHesab =14700000;
Last->Next = &Moshtari4;
Last = &Moshtari4;

Moshtari5.FirstName ="shahin";
Moshtari5.LastName ="najafi";
Moshtari5.ShomareHesab =5;
Moshtari5.MojudieHesab =256000;
Last->Next = &Moshtari5;
Last = &Moshtari5;
}

void Info()
{
system("cls");
cout << "PLZ ENT Your ShomareHesab:"<<endl;
cin >> Account.ShomareHesab;

P = First;
do
{
if(Account.ShomareHesab == P->ShomareHesab)
cout << "Mojudiye Shoma Hast:" << P->MojudieHesab;
P = P->Next;

}while(P->Next != NULL);

if(Account.ShomareHesab == P->ShomareHesab)
cout << "Mojudiye Shoma Hast:" << P->MojudieHesab;

getch();
}

void AddMoshtari()
{
system("cls");
cout << "Name Ra Vared Konid:";
cin >> Account.FirstName;
cout << "\nFamily Ra Vared Konid:";
cin >> Account.LastName;
cout << "\nShomareHesab Ra Vared Konid:";
cin >> Account.ShomareHesab;
cout << "\nMojodi Ra Vared Konid:";
cin >> Account.MojudieHesab;
P = First;
while(P->Next !=0)
P = P->Next;
P->Next =&Account;
getch();
}

void DelMoshtari()
{
int i,x = 0;
Bank *CurPtr = First, *NextPtr = First;
system("cls");
cout << "\nPLZ ENT Your ShomareHesab:";
cin >> Account.ShomareHesab;

while(NextPtr->Next != 0)
{
if(Account.ShomareHesab == NextPtr->ShomareHesab)
{
if (NextPtr == First)
{
First = First->Next;
cout << "Etelaat In Moshtari Pak Shod...";
break;
}
else if(NextPtr == Last)
{
CurPtr->Next = 0;
Last = CurPtr;
cout << "Etelaat In Moshtari Pak Shod...";
break;
}
else
{
CurPtr->Next = NextPtr->Next;
cout << "Etelaat In Moshtari Pak Shod...";
break;
}
}
else
{
CurPtr = NextPtr;
NextPtr = NextPtr->Next;
}
}
getch();
}

void AddPul()
{
long Amount;
system("cls");
cout << "\nShomareHesab Ra Vared Konid:";
cin >> Account.ShomareHesab;
cout << "\nMegdare Varizy Ra vared Konid:";
cin >> Amount;

P = First;
do
{
if(Account.ShomareHesab == P->ShomareHesab)
{
P->MojudieHesab += Amount;
cout << "Mojudie jadid:" << P->MojudieHesab;
}
P = P->Next;

}while(P->Next != NULL);

if(Account.ShomareHesab == P->ShomareHesab)
{
P->MojudieHesab += Amount;
cout << "Mojudie jadid:" << P->MojudieHesab;
}
getch();
}
void DellPul()
{
long Amount;
system("cls");
cout << "\nShomareHesab Ra Vared Konid:";
cin >> Account.ShomareHesab;
cout << "\nMegdare Varizy Ra vared Konid:";
cin >> Amount;

P = First;
do
{
if(Account.ShomareHesab == P->ShomareHesab)
{
P->MojudieHesab -= Amount;
cout << "Mojudie jadid:" << P->MojudieHesab;
}
P = P->Next;
}while(P->Next != NULL);

if(Account.ShomareHesab == P->ShomareHesab)
{
P->MojudieHesab += Amount;
cout << "Mojudie jadid:" << P->MojudieHesab;
}
getch();
}

void Update()
{
long ShomareHesab;
system("cls");
cout << "Shomare Hesabe Feli Ra Vared Konid:";
cin >> ShomareHesab;
cout << "\nName Jadid Ra Vared Konid:";
cin >> Account.FirstName;
cout << "\nFamily Jadid Ra Vared Konid:";
cin >> Account.LastName;
cout << "\nShomareHesab Jadid Ra Vared Konid:";
cin >> Account.ShomareHesab;
cout << "\nMojodi Jadid Ra Vared Konid:";
cin >> Account.MojudieHesab;

P = First;
do
{
if(ShomareHesab == P->ShomareHesab)
{
P->FirstName = Account.FirstName;
P->LastName = Account.LastName;
P->MojudieHesab = Account.MojudieHesab;
P->ShomareHesab = Account.ShomareHesab;
cout << "Etelaat Beroz Shod...";
}
P = P->Next;
}
while(P->Next != NULL);

if(Account.ShomareHesab == P->ShomareHesab)
{
P->FirstName = Account.FirstName;
P->LastName = Account.LastName;
P->MojudieHesab = Account.MojudieHesab;
P->ShomareHesab = Account.ShomareHesab;
cout << "Etelaat Beroz Shod...";
}
getch();
}

حذف ارسالي ويرايش ارسالي