Thread: A nudge in the right direction?

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

    A nudge in the right direction?

    Hello!
    I am takeing a computer science class in college, and am on my final program but am haveing some issues.
    This is the first use of Structs that we have had in a program and im not totaly sure how they work....
    I know how to do like 80% of the program but am hopeing someone could give me a nudge with how to work the structs for my program...
    (the assignment is posted to the web at this adress: http://www.cs.pdx.edu/~karlaf/CS161_...ign%20%236.htm )
    i know how to acess the files, how to pull info out of them with in.get and read them to the arrays, just need to figure out how to get the structs working, and also how to manipulate the functions with arguments.

    if anyone has 5-10 min of total bordom i would really appreciate any advie!
    Thank you in advance!

  2. #2
    CS Author and Instructor
    Join Date
    Sep 2002
    Posts
    511

    Wink

    What code do you have written? Post your attemped solution and more than likely you will get help from many people.
    Mr. C: Author and Instructor

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    6
    ok, i only have snippits, not anything solid, im just really hung up on the struct thing, cuz i not even sure how to pass them (by reference) through functions.....
    Code:::
    struct fullname
    {
    char firstname[15];
    char middlename[15];
    char lastname[15];
    };

    struct listing
    {
    fullname name;
    char title[31];
    char phone[15];
    int officenum;
    };

    void display(listing & fullname)
    {
    // Define local variables
    char firstname[15];
    char middlename[15];
    char lastname[15];
    char title [31];
    char phone[15];
    int officenum;
    char end_condition;

    // Read in from file
    ifstream in;
    in.open ("direct.dat");
    in.get (firstname, 15, ' ' || ';');
    in.get (end_condition);


    }
    :::Code

    hope that helps with the direction im trying to go.
    thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Some Direction Needed
    By Bidamin in forum C++ Programming
    Replies: 3
    Last Post: 04-22-2009, 10:15 AM
  2. Mouse Maze Problem
    By Furbiesandbeans in forum C++ Programming
    Replies: 13
    Last Post: 04-28-2008, 04:20 PM
  3. A nudge in the right direction please.
    By ftblstr2319 in forum C++ Programming
    Replies: 4
    Last Post: 04-10-2004, 06:41 PM
  4. Algorithm to walk through a maze.
    By Nutshell in forum C Programming
    Replies: 30
    Last Post: 01-21-2002, 01:54 AM
  5. Classic problem doesn't accept direction
    By cheesehead in forum C++ Programming
    Replies: 5
    Last Post: 11-13-2001, 06:32 PM