資源簡介
啤酒兩塊錢一瓶,4個(gè)瓶蓋換一瓶,2個(gè)酒瓶換一瓶,請(qǐng)問10元可以喝多少瓶酒
代碼片段和文件信息
using?System;
namespace?HelloWorldApplication
{
????class?HelloWorld
????{
????????static?void?Main(string[]?args)
????????{
????????????/*?我的第一個(gè)?C#?程序*/
????????????Console.WriteLine(“Hello?World!“);
????????????Console.ReadKey();
Exchange?ex=new?Exchange();
ex.Pay(108);
Console.WriteLine(ex.self.Jiu+“?jiu\r\n“+ex.self.Gai+“?gai\r\n“+ex.self.Ping+“?ping“);
????????}
????}
public?class?Exchange{
public?const?int?baseGai=4;//4個(gè)酒蓋換一瓶酒
public?const?int?basePing=2;//2個(gè)酒瓶換一瓶酒
public?const?int?basePrice=2;//2元一瓶酒
public?MySelf?self{get;set;}
public?void?Pay(int?price){
if(self==null)self=new?MySelf(
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????1365??2016-09-05?23:10??買酒換酒.cs
評(píng)論
共有 條評(píng)論