//Write your own contracts here. Currently compiles using solc v0.4.15+commit.bbb8e64f. pragma solidity ^0.5.0; contract QueueContract { uint constant QUEUE_SIZE = 5; struct Queue { string[] data; uint front; uint back; } Queue q; function newQueue() { q.data = new string[](QUEUE_SIZE); q.front = 0; q.back = 1; } function enqueue(string hash) { require(q.back != q.front); q.data[q.back] = hash; q.back = (q.back + 1) % QUEUE_SIZE; } function dequeue() returns (string) { string memory hash = q.data[q.front]; q.front = (q.front + 1) % QUEUE_SIZE; return hash; } }
0.4.18