1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

need some help

Discussion in 'C++' started by aparna007, Feb 3, 2011.

  1. aparna007

    aparna007 New Member

    1. Design and code a structure to describe a credit card with the following attributes:
    a. Credit card issuer
    b. Credit limit
    c. Current balance
    d. Expiration date (month/year)
    e. Current date (month/year)
    f. Credit card number
    g. Account holder name
    h. Available credit
    2. Write a function to read data from the user and store into the credit card structure.
    3. Write a function to print the credit card information.
    4. Write a function to determine if the card has expired and print a message to that
    5. Write a function that prompts the user for a purchase and update the credit card
    information. If over limit, print an appropriate message. Print the updated
    6. Write a function to accept a payment and update the credit card balance. Print the
    updated information.
    Write a main() function to test all functions. Test functions one at a time. When one
    function works, add the next function.

    This is a partial code can some fill in this code according to the description please..

    #include <iostream>
    using namespace std;
    struct CreditCardType
       string issuer;
       double limit;
       double curBalance;
       string expDate;
       string curDate;
       int  cardNum;
       string HolName;
       double avaLimit;
    } c1;
    void getInput();
    void display();
    void expiredate();
    void update();
    void payment();
    int main()
    //   CreditCardType c1;
       return 0;
    //void getInput(CreditCardType *beep)
    void getInput()
       cout << "Type issuer: ";
       getline(cin, c1.issuer);
    void display()
       cout << "the output comes here..." << endl;
       cout << c1.issuer << endl;
    Last edited by a moderator: Feb 4, 2011
  2. xpi0t0s

    xpi0t0s Mentor

    Where are you stuck? Or are you just posting your homework in the hope that someone will do it for you?
  3. aparna007

    aparna007 New Member

    i want to know how can we get data from the user in the function void getdata
  4. xpi0t0s

    xpi0t0s Mentor

    Do you know how to get data? (i.e. have you covered cin yet?)
    If you don't then you need to go over that material again, or tell the teacher it's impossible to do the task until he's taught it properly.

    If you DO know about cin, then it's just a case of writing the function and bunging some cin statements into it, isn't it? Have a go and see how far you get, rather than just assuming you can't do it and yelling for help.
  5. Umairajmal

    Umairajmal New Member

    yes he is right you ask your teacher to tell you how cin works. When you know about it you can easily get information.

Share This Page