//// VIEwController.swift// learn3//// Created by myhaspl on 16/1/23.// copyright (c) 2016年 myhaspl. All rights reserved.//import Cocoaclass VIEwController: NSVIEwController { var mystatck:[Int32]=[] 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 inputnum: NSTextFIEld! @IBOutlet weak var stackstate: NSTextFIEld! @IBAction func pushNumber(sender: AnyObject) { mystatck.append(inputnum.intValue) stackstate.stringValue="堆栈情况" for mynum in mystatck{ stackstate.stringValue+=String(mynum)+" " } } @IBAction func popNumber(sender: AnyObject) { let messageBox:NSAlert=NSAlert() if mystatck.count>0{ let removed = mystatck.removeLast() stackstate.stringValue="堆栈情况" for mynum in mystatck{ stackstate.stringValue+=String(mynum)+" " } messageBox.messageText="您取出了"+String(removed) } else{ messageBox.messageText="堆栈为空" } messageBox.alertStyle=NSAlertStyle.informationalAlertStyle messageBox.runModal() }}
堆栈算法 本博客所有内容是原创,如果转载请注明来源 http://blog.csdn.net/myhaspl/
}
总结以上是内存溢出为你收集整理的swift手记-3全部内容,希望文章能够帮你解决swift手记-3所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)