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

This is a discussion on Functions w/ only 1 vbl(ptr) to a Structure ...HELP! within the C++ Programming forums, part of the General Programming Boards category; Need help to write a function that obtains input from user for a student's information and the function's only argument ...

  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, 07:39 AM
  3. Functions in a Class Structure?
    By AndyBomstad in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2005, 05: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, 05:52 PM
  5. structure arrays to functions
    By caws in forum C Programming
    Replies: 9
    Last Post: 04-13-2003, 04:37 PM

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