Thread: Functions w/ only 1 vbl(ptr) to a Structure ...HELP!

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

    Exclamation Functions w/ only 1 vbl(ptr) to a Structure ...HELP!

    Need help to write a function that obtains input from user for a student's information and the function's only argument should be a pointer to a structure of the user defined type.

    Actual code examples will help as well as referring tutorials or help sites.

    Anything will help
    THX.
    C

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    You mean something like this:

    Code:
    // this is a small sample but you get the idea
    struct student {
        std::string last, first, middle;
        float gpa, class1, class2;
    }
    
    void calc_gpa(student *s) {
        s->gpa = (s->class1+s->class2)/2;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 02-14-2006, 09:04 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Functions in a Class Structure?
    By AndyBomstad in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2005, 04:51 AM
  4. Expression Manipulator v0.2 (bug fixes, functions)
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 05-26-2003, 04:52 PM
  5. structure arrays to functions
    By caws in forum C Programming
    Replies: 9
    Last Post: 04-13-2003, 03:37 PM