need some help

aparna007's Avatar, Join Date: Feb 2011
Newbie 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
effect.
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
information.
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..

Code:
#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;
   getInput();   
   display(); 
   system("PAUSE");
   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 shabbir; 4Feb2011 at 08:36.. Reason: Code blocks
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Where are you stuck? Or are you just posting your homework in the hope that someone will do it for you?
aparna007's Avatar, Join Date: Feb 2011
Newbie Member
i want to know how can we get data from the user in the function void getdata
xpi0t0s's Avatar, Join Date: Aug 2004
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.
Umairajmal's Avatar, Join Date: Dec 2010
Go4Expert 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.