C++ Class Queues

This is a discussion on C++ Class Queues within the C++ Programming forums, part of the General Programming Boards category; Please help me putting a single statement in bool full() & bool empty() Code: bool isFull() { return (Count() == ...

  1. #1
    "PALINDROME"
    Join Date
    Nov 2010
    Posts
    59

    C++ Class Queues

    Please help me putting a single statement in bool full() & bool empty()

    Code:
    bool isFull() {
    return (Count() == 5) == true;
    }
    
    //is it wrong? please correct it

  2. #2
    Registered User
    Join Date
    Mar 2011
    Posts
    61
    Just return Count() == 5.

  3. #3
    "PALINDROME"
    Join Date
    Nov 2010
    Posts
    59
    Ok thanks , by the way can you help me how to do a circular count! , not depending on the counter from enqueue and dequeue?

    Code:
    int Count() {
            return size;
        }

  4. #4
    "PALINDROME"
    Join Date
    Nov 2010
    Posts
    59
    in my enqueue I put size++ & dequeue I put size-- , but I want to put those two in one function

  5. #5
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,302
    Quote Originally Posted by [Student] View Post
    Ok thanks , by the way can you help me how to do a circular count! , not depending on the counter from enqueue and dequeue?

    Code:
    int Count() {
            return size;
        }
    Quote Originally Posted by [Student] View Post
    in my enqueue I put size++ & dequeue I put size-- , but I want to put those two in one function
    You'll first have to tell us what a "circular count" means.

    if you want those in one function them put them in one function. I can't see what you're doing wrong without seeing the code.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. queues
    By ashrrey in forum C Programming
    Replies: 3
    Last Post: 11-21-2010, 06:58 AM
  2. Queues, Nodes and passing instances of a class
    By xshapirox in forum C++ Programming
    Replies: 12
    Last Post: 11-13-2004, 12:06 PM
  3. help with queues
    By Raideen in forum C Programming
    Replies: 2
    Last Post: 07-24-2002, 10:56 PM
  4. queues
    By jamesb in forum C Programming
    Replies: 1
    Last Post: 04-21-2002, 08:57 PM
  5. queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 10-11-2001, 05:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21