Hi,
I'm working on classes with pointers. I do have a main function that calls this.
This program compiles. But the input from the user isn't getting passed to the other functions.
The user_input function should take the response and pass it to the create_posting then it is outputted to the display function.
I think the problem is in the user_input function but I've tried tweaking things and it still isn't working.
Any tips are appreciated.
class Posting
{
public:
Posting(); //Constructor
void user_input(char * input,char* &response);
void create_posting();
private:
char *type;
char *info;
char *place;
char *email;
};
Posting::Posting()
{
type=NULL;
info=NULL;
place=NULL;
email=NULL;
}
void Posting::user_input(char * input,char* &response)
{
char temp[500];
cout << input;
cin.get(temp,500,'\n');
cin.ignore(100,'\n');
response=new char[strlen(temp)+1];
response[0]=toupper(response[0]);
}
void Posting::create_posting()
{
user_input( "What type of posting is this? ", type);
user_input( "Give a short description of your posting: ",info);
user_input("What is your location? ", place);
user_input("What is your e-mail? ", email);
}
void Posting::display_posting()
{
cout<< "This is your posting"<<'\t'<<type<<'\t'<<info<<'\t'<<place<<'t'<<email <<endl;