using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
//using System.Collections.Generic;
namespace ConsoleApplication19
{
public class ColorInput
{
private int hConsoleHandle;
private const int STD_OUTPUT_HANDLE = -11;
[DllImport("kernel32.dll")]
private static extern int GetStdHandle(int nStdHandle);
[DllImport("kernel32.dll")]
private static extern int SetConsoleTextAttribute(int hConsoleOutput,
int wAttributes);
// 构造方法
public ColorInput()
{
hConsoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
}
//自己试出来的高亮颜色
public enum Foreground
{
Green=10,
Yellow,
Blue,
Red,
Purple,
Golder,
White
}
public void SetTextColor(int color)
{
SetConsoleTextAttribute(hConsoleHandle, color);
}
public void ResetColor()
{
SetConsoleTextAttribute(hConsoleHandle, 7);
}
}//class
class BankList
{
public int YuE = 2000;
public int JiaoYi;
public BankList()
{
// int YuE = 2000;
}
public BankList(int JiaoYi)
{
this.JiaoYi = JiaoYi;
}
}
//登录
public class Login
{
ColorInput colorText = new ColorInput();
public Login()
{
//colorText.SetTextColor((int)ColorInput.Foreground.Blue);
// Console.WriteLine(" 欢迎使用符森的银行管理系统!请输入密码:");
// Console.WriteLine("nihao");
colorText.SetTextColor((int)ColorInput.Foreground.Green);
Console.Write("/t/t欢迎使用");
colorText.SetTextColor((int)ColorInput.Foreground.Purple);
Console.Write("符森先生");
colorText.SetTextColor((int)ColorInput.Foreground.Green);
Console.Write("的银行管理系统!/n/n");
Console.WriteLine("/t/t/t/t郑重声明");
Console.WriteLine(@" 此系统纯属私有财产,知识产权属于个人所有,任何个人或集体不得未经本人允挪用,更不得转载翻刻
使用说明:请务必按照提示操作步骤进行,不得投机倒把,可以试试其他的功能,有不足的地方请登录我的博客wwww.fs13520.51.com互相谈论或者加上我的QQ:380727670:谢谢");
colorText.SetTextColor((int)ColorInput.Foreground.Red);
Console.WriteLine("是否已阅读次条款?/n");
colorText.SetTextColor((int)ColorInput.Foreground.Yellow);
Console.WriteLine("/t/t/t是【yes】 不是【no】");
string inp = Console.ReadLine();
L4: if (inp.ToString().ToLower() == "yes")
{
Console.WriteLine("欢迎使用此系统");
colorText.SetTextColor((int)ColorInput.Foreground.Red);
Console.WriteLine("请输入你的帐户密码:");
}
int code = int.Parse(Console.ReadLine());
if (code == 13520)
{
}
else
{
Console.WriteLine("你输入的密码错误!重新输入吧!提示下吧:13520");
goto L4;
}
Random random = new Random();
int a = random.Next(0, 9);
int b = random.Next(0, 9);
int c = random.Next(0, 9);
int d = random.Next(0, 9);
// Console.WriteLine("{0}{1}{2}{3}", a, b, c, d);
L3: Console.WriteLine("请输入验证码{0}{1}{2}{3}:", a, b, c, d);
int codeA = int.Parse(Console.ReadLine());
if (codeA == a * 1000 + b * 100 + c * 10 + d)
{
AfterLogin ok = new AfterLogin();
ok.Show();
}
else
{
Console.WriteLine("验证码错误笨蛋!请重新输入");
goto L3;
}
}
}
//登录成功后
public class AfterLogin
{
ColorInput colorText = new ColorInput();
public void Show()
{
Console.WriteLine(" 亲爱的!恭喜你登录成功");
L1: Console.WriteLine(" 当前用户是:6221881988806277774/n");
colorText.SetTextColor((int)ColorInput.Foreground.Yellow);
Console.WriteLine("/t1.取款 2.查询/n/n");
colorText.SetTextColor((int)ColorInput.Foreground.Golder);
Console.WriteLine("/t3.存款/n/n");
colorText.SetTextColor((int)ColorInput.Foreground.Red);
Console.WriteLine("/t4.取卡");
string input = Console.ReadLine();
if (input == "3")
{
Console.WriteLine("请输入的币种:美元(1)>英镑(2)>人民币(3)");
int inputA = int.Parse(Console.ReadLine());
if (inputA == 1 || inputA == 2 || inputA == 3)
{
Console.WriteLine("请输入存款金额");
int inputB = int.Parse(Console.ReadLine());
Console.WriteLine("恭喜你!存入成功");
BankList ban = new BankList(inputB);
BankList ban1 = new BankList(inputB);
Console.WriteLine("/n卡上余额为:" + ban1.YuE);//输出存入前的金额
Console.WriteLine("/n存入金额为:" + ban.JiaoYi);//输出用户存款金额
Console.WriteLine("/n存入后的卡上金额为:" + (ban1.YuE + ban.JiaoYi));//输出用户存款后的总金额
Console.WriteLine("/n谢谢光临,是否返回上一层看看还有什么需要的服务!(y/n)");
string sec = Console.ReadLine();
if (sec.ToString().ToLower() == "y")
{
goto L1;
}
if (sec.ToString().ToLower() == "n")
{
Console.WriteLine("那就推出了哟!");
}
}
}
if (input == "1")
{
Console.WriteLine("请输入你要取的金额");
int inputC = int.Parse(Console.ReadLine());
BankList ban2 = new BankList();
BankList ban = new BankList(inputC);
Console.WriteLine("/n当前卡上余额为:" + (ban2.YuE - 10));//输出当前卡上余额
Console.WriteLine("/n你要取的金额为:" + ban.JiaoYi);//输入用户的取款金额
if (ban.YuE > inputC)//判断要余额大于交易金额才能进行交易
{
Console.WriteLine("/n取款后的金额为:" + (ban.YuE - inputC));//输出用户交易成功后卡上金额
Console.WriteLine("/n谢谢光临,是否返回上一层看看还有什么需要的服务!(y/n)");
string sec = Console.ReadLine();
if (sec.ToString().ToLower() == "y")
{
goto L1;
}
if (sec.ToString().ToLower() == "n")
{
Console.WriteLine("那就推出了哟!");
}
}
else
{
Console.WriteLine("/n对不起,你的卡上余额不足,交易失败!");
}
}
if (input == "4")
{
Console.WriteLine("请在三十秒钟内取出磁卡......");
}
if (input == "2")
{
BankList cha = new BankList();
Console.WriteLine("你目前卡上的余额是:{0}", cha.YuE);
Console.WriteLine("是否需要其他的服务呢(y/n)");
string sec = Console.ReadLine();
if (sec.ToString().ToLower() == "y")
{
goto L1;
}
if (sec.ToString().ToLower() == "n")
{
Console.WriteLine("那就推出了哟!");
}
}
}
}
public class Aply
{
static void Main()
{
Login Lo = new Login();
}
}
}