Hi all
I am a beginer programer in c++ and am trying to enter a name say for example joe bloggs but as im only entering in using char i only get joe.
Below is the class im trying to create. What do i need to modify to get to accept the second part of the name joe bloggs?
#include <fstream.h>
#include <string.h>
class person
{
private:
char name[40];
int age;
public:
void getData(void)
{
cout << "\nEnter name: "; cin >> name;
cout << "\nEnter age: "; cin >> age;
}
void showData(void)
{
cout << "\n Name: " << name;
cout << "\n Age: " << age;
}
};
Anyone helps is greatly appricated.
regards
Steve
I am a beginer programer in c++ and am trying to enter a name say for example joe bloggs but as im only entering in using char i only get joe.
Below is the class im trying to create. What do i need to modify to get to accept the second part of the name joe bloggs?
#include <fstream.h>
#include <string.h>
class person
{
private:
char name[40];
int age;
public:
void getData(void)
{
cout << "\nEnter name: "; cin >> name;
cout << "\nEnter age: "; cin >> age;
}
void showData(void)
{
cout << "\n Name: " << name;
cout << "\n Age: " << age;
}
};
Anyone helps is greatly appricated.
regards
Steve