Bjarne Stroustrup The c++ Programming Language (3rd ed)

This is a discussion on Bjarne Stroustrup The c++ Programming Language (3rd ed) within the C++ Programming forums, part of the General Programming Boards category; I've gotten an assignment at uni to solve exercise 11 (chapter 12) in the above mentioned book. To be honest ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    2

    Question Bjarne Stroustrup The c++ Programming Language (3rd ed)

    I've gotten an assignment at uni to solve exercise 11 (chapter 12) in the above mentioned book.

    To be honest Im not sure how to approch this exercise and Im hoping someone on here might be able to help me out.

    Dont get me wrong, Im not looking for someone to solve it for me, just maybe give some tips\hints to get me started.

    So far I've made a ctask with a static scheduler and a cqueue class.

    Im very unclear on howto make the save and restore method. The scheduler is also difficult subject.

    Thanks for any response.

  2. #2
    Shadow12345
    Guest
    okay don quijote there are many C++ programmming books out there, and I would be surprised if anyone would know off hand what that particular question is asking. Post your question, post anything you have done so far on the question including code, post a specific problem you are having with the question, and people will help you.

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    I recommend you look up documentation on the old task.h library from google. That should get you started on your way.

    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    2
    Exercise
    Design and implement a library for writing event driven simulations. Hint <task.h> However, that is an old program and you can do better. There should be a class CTask. An object of class CTask should be able to save it's state and to be have that state restored. (You might define CTask::save() and CTask::restore() so that it can operate as a coroutine. Specific tasks can be defined as objects of classes derived from CTask. The program to be executed by a task might be specified as a virtual function. It should be possible to pass arguments to a new task as argument to it's constructor(s). There should be a scheduler implementing a concept of virtual time. Provide a function CTask::delay(long) that "consumes" virtual time. Wether the scheduler is part of the class CTask or separate will be one of the major design decisions. The tasks will need to communicate. Design a class CQueue for that. Devise a way for a task to wait for input for several queues. Handle run-time errors in a uniform way. How would you debug programs written for such a library.


    Code:
    //CTask.h
    class CTask
    {
      public:
      CTask();
      
      void Save();
      void Restore();
      void Delay();
      static void Sceduler();
    };
    
    //have not added any code to the .cpp file so I only included the header file.
    
    //CQueue
    class Queue
    {
      // Was thinking about adding some kind of shared buffer for the 
      // CTask's to use as a medium to communicate.
    };
    This about what I have so far, just the body, no real code.

    Have search for both task.h and queue.h on google without finding anything really usefull.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Language of choice after C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 06-15-2004, 01:20 AM
  2. Interview with Bjarne Stroustrup "C++ a joke"
    By novacain in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 03-31-2003, 10:55 PM
  3. Exclusive Interview With Bjarne Stroustrup
    By Osama Lives in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-07-2002, 03:17 PM

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