This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts "what is your temperature (write degree as C or F)" | |
| degree = gets.chomp; | |
| if degree.include?("F") | |
| degreeC = degree.split("") - ["F"] | |
| newDegree = degreeC.join.to_i * 9/5 +32 | |
| puts "the Temperature is " + newDegree.to_s + " degrees Celsius" | |
| end | |
| if degree.include?("C") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alpha = "abcdefghijklmnopqrstuvwxyz" | |
| key = 2 | |
| puts "what is your input" | |
| name = gets.chomp | |
| for i in alpha.split("") | |
| c = name.split("")[alpha.index(i)] | |
| o = alpha.index(c) | |
| m = o + key | |
| p = alpha.split("")[m] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Queue() { | |
| this.tail = null; | |
| this.head = null; | |
| } | |
| Queue.prototype.enqueue = function(n) { | |
| if(this.head == null){ | |
| this.head = n; | |
| this.tail = n; | |
| } | |
| else{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Stack(){ | |
| this.top = null; | |
| this.length = 0; | |
| } | |
| Stack.prototype.push = function(n){ | |
| //the new node has to be the top so the old top should become the new node's NextNode because it should be second | |
| n.setNextNode(this.top); | |
| //then you should make the new node the top | |
| this.top = n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var counter = 0; | |
| var n = new Node() | |
| Stack = function(){ | |
| This.top = null; | |
| } | |
| Stack.prototype.push = function(){ | |
| if( this.top == null){ | |
| this.top = n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Queue() { | |
| this.tail = null; | |
| this.head = null; | |
| } | |
| Queue.prototype.enqueue = function(n) { | |
| //this.head = n; | |
| //n.getNextNode = this.tail; | |
| if(this.head == null){ | |
| this.head = n; | |
| return this.head; |
NewerOlder