//// VIEwController.swift// learn4//// Created by myhaspl on 16/1/23.// copyright (c) 2016年 myhaspl. All rights reserved.//import Cocoaclass VIEwController: NSVIEwController { var fifoquene=[Int]() var lifoquene=[Int]() overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() // Do any additional setup after loading the vIEw. } overrIDe var representedobject: AnyObject? { dIDSet { // Update the vIEw,if already loaded. } } @IBOutlet weak var inputnum1: NSTextFIEld! @IBOutlet weak var inputnum2: NSTextFIEld! @IBOutlet weak var fifostate: NSTextFIEld! @IBOutlet weak var lifostate: NSTextFIEld! @IBAction func lifopop(sender: AnyObject) { let messageBox:NSAlert=NSAlert() if lifoquene.count>0{ let mynum=lifoquene.removeLast() lifostate.stringValue="后进先出"+" " for num in lifoquene{ lifostate.stringValue=lifostate.stringValue+String(num)+" " } messageBox.messageText="您取出了"+String(mynum) } else{ messageBox.messageText="队列为空" } messageBox.alertStyle=NSAlertStyle.informationalAlertStyle messageBox.runModal() } @IBAction func lifopush(sender: AnyObject) { if let mynum=inputnum2.stringValue.toInt(){ lifoquene.append(mynum) lifostate.stringValue+=" "+String(mynum) } } @IBAction func fifopop(sender: AnyObject) { let messageBox:NSAlert=NSAlert() if fifoquene.count>0{ let mynum=fifoquene.removeAtIndex(0) fifostate.stringValue="先进先出"+" " for num in fifoquene{ fifostate.stringValue=fifostate.stringValue+String(num)+" " } messageBox.messageText="您取出了"+String(mynum) } else{ messageBox.messageText="队列为空" } messageBox.alertStyle=NSAlertStyle.informationalAlertStyle messageBox.runModal() } @IBAction func fifopush(sender: AnyObject) { if let mynum=inputnum1.stringValue.toInt(){ fifoquene.append(mynum) fifostate.stringValue+=" "+String(mynum) } } }本博客所有内容是原创,如果转载请注明来源 http://blog.csdn.net/myhaspl/
总结
以上是内存溢出为你收集整理的swift手记-4全部内容,希望文章能够帮你解决swift手记-4所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)