Thursday, September 11, 2014

of these two functions absolutely do not know how it got implemented inside ... unless you have it


Hello, I need help from the tray. I righted LIFO stack and would like it converted to FIFO, but have no idea how. If I understand backpage ny correctly, that would be enough to remake the push or pop method, right? (Both methods attach). Could someone help me how to do it?
// Push - Insert the top of the reservoir void stack :: push (int iNum) {element backpage ny * new; new = new element; New-> filled (iNum, first); prvy = new; //} Pop - choose from the top of the reservoir void stack :: pop () {if (first! = NULL) {int iNum; * uk element; backpage ny uk = First; UK- iNum => list (); if (UK-> kontrola_adresy ()) {cout << UK-> list (); prvy UK- => address (); } If ((UK-> kontrola_adresy () == false) && (iNum! = 0)) {prvy = NULL; }} Else {cout << "No element to delete" << endl; Thank you}}. Looking for a handy software? ETARGET
of these two functions absolutely do not know how it got implemented inside ... unless you have it implemented as a linked list (preferred method) ... the FIFO need to store the location of the last element, ie from one side to the list adds up to the other side withdraws backpage ny from the list (it is up to you whether you add to the end and take a start or add to the top and take in the end) .. more important question would be: why not implement itself .. when you use C ++ it is better to use templates stack and queue in STL ? _________________ ~ Listen to your brain, not your heart ~ NB1: Lenovo Y500: CPU: Intel Core i7-3630QM; GPU: Nvidia GT650M 2 gigabytes SLi; RAM 16GB DDR3; HDD: 1TB SSD + 256 gigabytes (m4); LCD: 15.6 "1920x1080; OS: 64-bit Win8.1 + Arch Linux 64-bit backpage ny (UEFI Powered dualboot) NB2: Asus K53SJ-SX093: CPU: Intel Core i3-2310M; GPU: Intel HD3000 backpage ny / Nvidia GT520M 1 gigabyte Optimus; RAM: 8 GB DDR3, SSD: 128 gigabytes 840Evo; LCD: 15.6 "1366x768; OS: Win Pro 8.1 64-bit (UEFI) crki76
Queue my header looks like this # pragma once # include "StdAfx.h" # include "MyStack.h" # include "Queue.h" # include <stddef.h> template <class itemtype> struct NodeType; template <class itemtype> QueType class {public: QueType (); ~ QueType (); MakeEmpty void (); bool IsEmpty () const; IsFull bool () const; backpage ny void Enqueue (itemtype newItem); void dequeue (itemtype & item); printQueue void (); private: NodeType <itemtype> * qFront; NodeType <itemtype> * qRear; }; template <class itemtype> QueType <itemtype> :: QueType () {qFront = NULL; qRear = NULL; } Template <class backpage ny itemtype> QueType <itemtype> :: ~ QueType () {MakeEmpty (); } Template <class itemtype> void QueType <itemtype> :: MakeEmpty backpage ny () {NodeType <itemtype> * tempPtr; while (qFront! = NULL) {tempPtr = qFront; qFront qFront- => next; delete tempPtr; QRear} = NULL; } Template backpage ny <class itemtype> backpage ny bool QueType <itemtype> :: IsFull () const {NodeType <itemtype> * ptr; ptr = new NodeType <itemtype>; if (ptr == NULL) return true; else {delete ptr; return false; }} Template <class itemtype> bool QueType <itemtype> :: IsEmpty () const {return (qFront == NULL); } Template <class itemtype> void QueType <itemtype> :: Enqueue (itemtype newItem) {NodeType <itemtype> * NEWNODE; NEWNODE = new NodeType <itemtype>; newNode-> info = newItem; newNode-> next = NULL; if (qRear == NULL) qFront = NEWNODE; else & nbs

No comments:

Post a Comment