0

I'm trying to get the user to input data but the compiler skips the getline function in my cpp program.What could be the problem? Here is the code.


#include <iostream>

using namespace std;

struct Customer{

 char name[10];
 char email[30];
 int age ;
 int idno;
 string date;


};

int main()
{
  Customer cust;
   cout<<"Enter the name of the customer"<<endl;
   cin>>cust.name;

   cout<<"Enter the email of the customer"<<endl;
   cin>>cust.email;

   cout<<"Enter the age of the customer"<<endl;
   cin>>cust.age;

   cout<<"Enter the id number of the customer"<<endl;
   cin>>cust.idno;

   cout<<"Enter the date of birth of the customer"<<endl;
   getline(cin,cust.date);


   cout<<"The details of the customer are"<<endl;
   cout<<"Name :"<<cust.name<<endl;
   cout<<"Email :"<<cust.email<<endl;
   cout<<"Age :"<<cust.age<<endl;
   cout<<"Id number :"<<cust.idno<<endl;
   cout<<"Date of birth :"<<cust.date<<endl;

   return 0;
}

Here is the output of the program

0 Answers0