#include"Credit.h"
void Credit::menu()
{
system("cls");
cout<<"\n\n\n\n\n\t\t※※※※※※※※※※※※※※※※※※※※※※※※※※※※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ 《欢迎使用小额贷款系统》 ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ 本系统支持1—20万的贷款服务 ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ 单击任意键继续 ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※※※※※※※※※※※※※※※※※※※※※※※※※※※※\n"<<endl;
getch();
index();
}
void Credit::borrow()
{
system("cls");//清屏
cout<<"\n\n\n\t\t创建贷款信息: \n"<<endl;
cout<<"\t\t*********************************************\n"<<endl;
cout<<"\n\t\t请输入您的姓名: ";
cin>>Name[time];
while(1){
cout<<"\n\t\t请输入贷款天数:";
cin>>days[time];
if(days[time]<=0)
{
cout<<"\n\t\tSorry!请输入正确的天数!"<<endl;
}
break;
}
cout<<"\n\t\t预留联系方式: ";
cin>>Tel[time];
while(1){
cout<<"\n\t\t请输入贷款金额: ";
cin>>Money[time];
if(Money[time]<MinMoney||Money[time]>MaxMoney)
{
cout<<"\n\t\tSorry!贷款金额不在系统处理范围"<<endl
<<"\n\t\t是否退出? Y or N "<<endl;
cout<<"\n\t\t";
cin>>YN;
if(YN=='Y'||YN=='y')
{
close();
}
}else{
break;
}
}
cout<<"\n\t\t正在确认信用度,请稍等..."<<endl;
_sleep(2000);
if(Money[time]>Pcredit)
{
cout<<"\n\t\tSorry!您的信用度不足"<<endl
<<"\n\t\t是否退出? Y or N "<<endl;
cout<<"\n\t\t";
cin>>YN;
if(YN=='Y'||YN=='y')
{
close();
}else{
_sleep(500);
index();
}
}else{
cout<<"\n\t\t贷款成功!"<<endl<<"\n\t\t您的贷款编号为:"<<++time<<"按任意键继续";
getch();
index();
}
}
void Credit::back()
{
system("cls");
cout<<"\n\n\n\t\t*********************************************\n"<<endl;
if(time==0)
{
cout<<"\n\t\t尚未查到您的贷款记录"<<endl<<"按任意键继续";
}
while(time>0)
{
cout<<"\n\t\t请输入您的贷款编号: ";
cin>>num;
if(num<=0||num>time)
{cout<<"\n\t\t尚未查到您的贷款信息"<<endl;}
else{
for(int i=0;i<time;i++)
{
if(num-1==i)
{
int Sum = Money[i]+(Money[i]*days[i]*extra);
cout<<"\n\t\t---------------------------------------------\n"<<endl;
cout<<"\n\t\t您的贷款记录为:"<<endl;
cout<<"\n\t\t贷款人:"<<Name[i]<<",第"<<i+1<<"次贷款金额:"<<Money[i]<<"\t\t,您需要还款"<<Sum<<"元;"<<endl;
while(1){
cout<<"\n\t\t请输入还款金额:";
cin>>PayBack;
if(PayBack<Sum)
{
cout<<"\n\t\t还款金额不足!正在退钞,请稍候..."<<endl;
_sleep(1000);
cout<<"\n\t\t退钞成功!"<<endl;
break;
}else if(PayBack==Sum){
cout<<"\n\t\t还款成功!"<<endl;
//time2++;
break;
}else{
cout<<"\n\t\t还款成功! 找余"<<PayBack-Sum<<"元"<<endl;
//time2++;
break;
}
}
break;
}
}
}
break;
}
getch();
index();
}
void Credit::close()
{
system("cls");
cout<<"\n\n\n\n\n\t\t※※※※※※※※※※※※※※※※※※※※※※※※※※※※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ 感谢您的使用! ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※ ※\n"
<<"\t\t※※※※※※※※※※※※※※※※※※※※※※※※※※※※\n"<<endl;
_sleep(1000);
exit(0);
}
void Credit::message()
{
system("cls");
cout<<"\n\n\n\t\t*********************************************\n"<<endl;
if(time==0)
{
cout<<"\n\t\t尚未查到您的贷款信息"<<endl<<"按任意键继续";
}
while(time>0)
{
cout<<"请输入你的贷款编号:";
cin>>num;
if(num<=0||num>time)
{cout<<"\n\t\t尚未查到您的贷款信息"<<endl;}
else{
for(int i=0;i<time;i++){
if(num-1==i){
cout<<"\n\t\t---------------------------------------------\n"<<endl;
cout<<"\n\t\t借款人:"<<Name[i]<<endl;
cout<<"\n\t\t联系电话: "<<Tel[i]<<endl;
cout<<"\n\t\t信用度: "<<Pcredit<<endl;
cout<<"\n\t\t借款金额: "<<Money[i]<<endl;
cout<<"\n\t\t贷款天数:"<<days[i]<<endl;
break;
}
}
}
cout<<"\n\t\t*********************************************\n"<<endl;
cout<<"\n\t\t单击任何键返回主菜单!";
break;
}
getch();
index();
}
void Credit::index()
{
int x;
system("cls");
cout<<"\n\n\n\t\t 主菜单 \n\n";
cout<<"\t\t***************************************************\n"
<<"\t\t* *\n"
<<"\t\t* *\n"
<<"\t\t* 操作方式: *\n"
<<"\t\t* *\n"
<<"\t\t* 1.贷款 2.还款 *\n"
<<"\t\t* *\n"
<<"\t\t* 3.个人征信 4.退出 *\n"
<<"\t\t* *\n"
<<"\t\t* *\n"
<<"\t\t***************************************************\n"<<endl;
cout<<"\n\t\t请选择操作方式: "<<endl;
cin>>x;
switch(x)
{
case 1:
borrow();
break;
case 2:
back();
break;
case 3:
message();
break;
case 4:
close();
break;
default:
system("cls");
cout<<"\n\n\n\t\t\t输入错误! 请输入数字1-4\n"<<endl;
_sleep(1000);
index();
break;
}
}
void main()
{
Credit u;
u.MaxMoney=200000;//贷款上限为20万
u.MinMoney=10000;//贷款下限为1万
//u.time2=0;
u.Pcredit=80000;//初始信用额度80000
u.extra=0.00027;//初始化利息
u.time=0;
u.num=0;
u.menu();
}