Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   need some help (http://www.go4expert.com/forums/need-some-help-t24841/)

aparna007 4Feb2011 00:49

need some help
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;

xpi0t0s 4Feb2011 12:27

Re: need some help
Where are you stuck? Or are you just posting your homework in the hope that someone will do it for you?

aparna007 5Feb2011 06:39

Re: need some help
i want to know how can we get data from the user in the function void getdata

xpi0t0s 5Feb2011 14:07

Re: need some help
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 6Feb2011 11:33

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

All times are GMT +5.5. The time now is 15:43.