help with program

This is a discussion on help with program within the C++ Programming forums, part of the General Programming Boards category; help with program hello everyone, i am in need of serious help. i have this program to make fand i ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    3

    help with program

    help with program
    hello everyone, i am in need of serious help. i have this program to make fand i need someone to steer me in the right direction as i am completely lost. this is what i have to do:

    The Multilevel Feedback Queue(q=2i)has at most 5 queues. q0,q1,...,q4 and he schedule in each queue is round robin with time slice = 2i. A process is put into queue q0 when it enters the system, and is demoted to the next lower level queue when it finishes running its time slice.

    Write a C++ program which will compile under g++ and run on the unix operating system on pegasus, which will read several lines from a file named processes.txt. Each line in the file contains two integers: the first integer represents the arrival time of a process and the second integer represents the service time for this process. Each line corresponds to one process, and you do not know in advance how many lines there will be in the file. At the end of the last line, there will be an end-of-file character.

    The program you write will calculate the Feedback schedule for q=2i for the collection of processes whose vital statistics the program read from the file processes.txt. The schedule should be written to a file called schedule.txt. The form of the schedule should be 1,1,1,2,3,2,2,4,5,3,3,4,4,5,2,2,2,3,4,4 for Feedback q=2i.

    If the CPU is idle for a number of unit times, you should indicate this by a sequence of contiguous commas, i.e., ,,,,,,

    You may assume that the lines of processes.txt are sorted according to arrival times

    if someone can help me out in any way be it by providing me with some example of how to accomplish this or i dont know anything i need help, please pm or email me. thanks in advance

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    Well, you have to start somewhere. Just make your best effort to code this...then, when you have a problem with a bit of code, post it here, along with the compiler and OS you're using, the specific errors you're getting, etc. Good luck.
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    3
    but thats the problem i dont know how to start, with what can this be done.

  4. #4
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,157
    Originally posted by noobprog
    but thats the problem i dont know how to start, with what can this be done.
    Ok here's your start:
    Code:
    #include <stdio.h>
    
    int main()
    {
        // code here to solve the problem
        return 0;
    }
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  5. #5
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,643
    >> but thats the problem i dont know how to start, with what can this be done.

    Start by doing research. Create diagrams and flowcharts so that you can work things out in your head. Break things down into smaller problems. Ask specific questions to specific problems. Write code. Throw yourself into it, man!
    Code:
    if( numeric_limits< byte >::digits != bits_per_byte )
        error( "program requires bits_per_byte-bit bytes" );
    24bbs.cpp

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    this is a simple program that opens a file and reads from it, then does something based on the information it gets from the file... just to get you started:
    Code:
    #include<iostream>
    #include<fstream>
    
    using std::ifstream;
    
    int main()
    {
        int someint1,someint2;
    
        ifstream infile("processes.txt");
    }
    >>please pm or email me. thanks in advance
    that's not how it works on a message board...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  7. #7
    Registered User
    Join Date
    Mar 2004
    Posts
    3
    thanks for your replies. im not very experienced at this im just starting out, how deep will i have to go to make a program like this. say if i started out with controls, functions, arrays, pointers, strings etc. how far down will i have to go to get this accomplished this. what knowledge is neccessary to make something like the program i need help with.

  8. #8
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    you can probably get away with just going up to file I/O...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 12:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 12:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 09:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

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