Click here to Skip to main content
15,915,703 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: i can't understand why this result is showed~ Pin
CPallini10-Jul-08 22:02
mveCPallini10-Jul-08 22:02 
AnswerRe: i can't understand why this result is showed~ Pin
Stephen Hewitt10-Jul-08 22:12
Stephen Hewitt10-Jul-08 22:12 
Questiongraph using ProEssentials v6 in vc++ Pin
ani_ikram10-Jul-08 21:32
ani_ikram10-Jul-08 21:32 
QuestionHow to communicate between two activex? Pin
manish.patel10-Jul-08 21:09
manish.patel10-Jul-08 21:09 
QuestionConvert English letter to japenese Pin
manju#12310-Jul-08 20:54
manju#12310-Jul-08 20:54 
QuestionRe: Convert English letter to japenese Pin
jazy110-Jul-08 23:09
jazy110-Jul-08 23:09 
AnswerRe: Convert English letter to japenese [modified] Pin
Michael Schubert11-Jul-08 2:48
Michael Schubert11-Jul-08 2:48 
QuestionHow to create a .h file in C++? Pin
Shah Ravi10-Jul-08 20:50
Shah Ravi10-Jul-08 20:50 
Hi! I have written a Clas in C++ but my professor wants me to turn in .h file instead of the whole program and i don't know exactly how to do it. Can anyone show me steps to create a .h file, please? Thank you. This is the program i have:

[code]
#include <iostream>
#include <string>
using namespace std;

class CCustomer
{
private:
string Card_number;
public:
string first_name;
string last_name;
string customer_ID;
CCustomer();//Default constructor
CCustomer(string, string, string, string);//Parameterized constructor
CCustomer(CCustomer&);//Copy constructor
void input();//Function to get inputs
void output();//Function to get outputs
void display();//To display the info of a customer
string getCard_number();//Accessor
void setCard_number (string Card_Num);//Mutator
};

void main()
{
CCustomer myself;
CCustomer yourself("Ravi", "Shah", "A123", "1111 2222 3333 4444");
yourself.output();
CCustomer name(yourself);
yourself.output();
myself.input ();
string myCardNum = myself.getCard_number();
myself.setCard_number ("1234 5678 1234 5678");
myself.output();
}

CCustomer::CCustomer()
{
first_name = "no name";
last_name = "no name";
customer_ID = "no info";
Card_number = ("0000 0000 0000 0000");
}

CCustomer::CCustomer(string f, string l, string id, string n)
{
first_name = f;
last_name = l;
customer_ID = id;
Card_number = n;
}

CCustomer::CCustomer(CCustomer& x)
{
first_name = x.first_name;
last_name = x.last_name;
customer_ID = x.customer_ID;
setCard_number(x.getCard_number());
}

void CCustomer::input()
{
cout << "Please enter your first name, last name, customer ID, and card number each" << endl;
cout << "seperated by space, then press enter ";
cin >> first_name
>> last_name
>> customer_ID
>> Card_number;
setCard_number(Card_number);
}

void CCustomer::output()
{
cout << "First name: " << first_name << endl;
cout << "Last name: " << last_name << endl;
cout << "Customer ID: " << customer_ID << endl;
cout << "Card number: " << getCard_number() << endl;
}

void CCustomer::display()
{
cout << first_name << ' ' << last_name << ' ' << customer_ID << ' ' << getCard_number() << endl;
}

string CCustomer::getCard_number()
{
return Card_number;
}

void CCustomer::setCard_number (string Card_Num)
{
Card_number = Card_Num;
}[/code]
AnswerRe: How to create a .h file in C++? Pin
Richard Andrew x6410-Jul-08 20:57
professionalRichard Andrew x6410-Jul-08 20:57 
GeneralRe: How to create a .h file in C++? Pin
Shah Ravi10-Jul-08 21:01
Shah Ravi10-Jul-08 21:01 
GeneralRe: How to create a .h file in C++? Pin
Richard Andrew x6410-Jul-08 21:05
professionalRichard Andrew x6410-Jul-08 21:05 
GeneralRe: How to create a .h file in C++? Pin
Cedric Moonen10-Jul-08 21:39
Cedric Moonen10-Jul-08 21:39 
AnswerRe: How to create a .h file in C++? Pin
T.RATHA KRISHNAN10-Jul-08 22:47
T.RATHA KRISHNAN10-Jul-08 22:47 
AnswerRe: How to create a .h file in C++? Pin
pallaka10-Jul-08 22:47
pallaka10-Jul-08 22:47 
QuestionMemoryleak Pin
T.RATHA KRISHNAN10-Jul-08 20:30
T.RATHA KRISHNAN10-Jul-08 20:30 
AnswerRe: Memoryleak Pin
Cedric Moonen10-Jul-08 20:38
Cedric Moonen10-Jul-08 20:38 
QuestionRe: Memoryleak Pin
T.RATHA KRISHNAN10-Jul-08 20:45
T.RATHA KRISHNAN10-Jul-08 20:45 
AnswerRe: Memoryleak Pin
Cedric Moonen10-Jul-08 20:46
Cedric Moonen10-Jul-08 20:46 
AnswerRe: Memoryleak Pin
Richard Andrew x6410-Jul-08 20:43
professionalRichard Andrew x6410-Jul-08 20:43 
GeneralRe: Memoryleak Pin
pallaka10-Jul-08 20:53
pallaka10-Jul-08 20:53 
GeneralRe: Memoryleak Pin
Richard Andrew x6410-Jul-08 20:55
professionalRichard Andrew x6410-Jul-08 20:55 
GeneralRe: Memoryleak Pin
Cedric Moonen10-Jul-08 20:58
Cedric Moonen10-Jul-08 20:58 
QuestionRe: Memoryleak Pin
CPallini10-Jul-08 21:22
mveCPallini10-Jul-08 21:22 
QuestionError "String data, right truncated". Pin
Le@rner10-Jul-08 20:23
Le@rner10-Jul-08 20:23 
AnswerRe: Error "String data, right truncated". Pin
Richard Andrew x6410-Jul-08 20:40
professionalRichard Andrew x6410-Jul-08 20:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.