日期:2014-05-18  浏览次数:21115 次

关于ATM取款机的转账代码怎么写?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleATM
{
  class Program
  {
  static void Main(string[] args)
  {
  UserInfor us = new UserInfor();
  UserInfor[] user = new UserInfor[10];
  user[0] = new UserInfor("1000","磊1","123","123456",1000);
  user[1] = new UserInfor("1001", "磊2", "123","123456", 10000);
  user[2] = new UserInfor("1002", "磊3", "123","123456", 10000);
  user[3] = new UserInfor("1003", "磊4", "123","123456", 10000);
  user[4] = new UserInfor("1004", "磊5", "123","123456", 10000);
  user[5] = new UserInfor("1005", "磊6", "123","123456", 10000);
  user[6] = new UserInfor("1006", "磊7", "123","123456", 10000);
  user[7] = new UserInfor("1007", "磊8", "123","123456", 10000);
  user[8] = new UserInfor("1008", "磊9", "123","123456", 10000);
  user[9] = new UserInfor("1009", "磊10", "123","123456", 10000);

  Console.WriteLine("**************************************");
  Console.WriteLine("**************ATM取款机***************");
  Console.WriteLine("**********欢迎您使用取款机************");
  Console.WriteLine("**************************************");
  us.Balance = 10000;
  Console.WriteLine("请输入卡号:");
  string card =Console.ReadLine();

  Console.WriteLine("请输入密码:");
  string paw =Console.ReadLine();
  for (int i = 0; i < 11; i++)
  {
  if (card == user[i].Num &&paw ==user [i].Password )
  {
  Console.WriteLine("欢迎您{0}使用ATM取款机",user [i].Name );
  for (int j = 0; j < 100; j++)
  {
  us.menu();
  int c = int.Parse(Console .ReadLine ());
  switch (c)
  {
  case 1:
  us.yue();
  break;
  case 2:
  us.qukuang ();
  break;
  //case 3:
  // us.zhuanzhan();
  // break;
  case 4:
  us.cunkuang ();
  break;
  case 5:
  us.tuika ();
  return;
  }
  }

  }
  }
  Console.ReadLine();
  }
  }
}










------解决方案--------------------<