title: how can I print a char array in c++
body: <p>I am working on a simple hotel reservsation Project but I couldn't print the customer name and payment type after entering their names'. Here is the piece of code that I typed.</p>
  
  <pre><code> cout &lt;&lt; "Please enter the customer name: " &lt;&lt; endl;
   cin &gt;&gt; customername1;
   cin.getline(customername1,100,'\n');
   fflush(stdin);
   cout &lt;&lt; "Please enter the payment type: " &lt;&lt; endl;
   cin &gt;&gt; paymenttype;
   cin.getline(paymenttype,100,'\n');
   fflush(stdin);
   cout &lt;&lt; "How many days would you like to stay: " &lt;&lt; endl;
   cin &gt;&gt; days;
   room_income = days * 30;
   count_room++ ;
   count_customer1++ ;
   customer_name1[single]= new char [strlen(customername1)+1]; 
   strcpy(customer_name1[single],customername1); 
   payment_type[single]= new char [strlen(paymenttype)+1]; 
   strcpy(payment_type[single],paymenttype);
   cout &lt;&lt; "Room number : " &lt;&lt; single &lt;&lt; endl&lt;&lt; endl;
   cout &lt;&lt; "Customer name : "&lt;&lt; customer_name1 &lt;&lt; endl &lt;&lt; endl;
   cout &lt;&lt; "Payment type : "&lt;&lt; payment_type &lt;&lt; endl&lt;&lt; endl;
   cout &lt;&lt; "Number of day for accomodation :"&lt;&lt; days &lt;&lt; endl&lt;&lt; endl;
   cout &lt;&lt; "Income for this room : "&lt;&lt; room_income&lt;&lt; endl&lt;&lt; endl;
  </code></pre>
  
  <p>Some random numbers and letters are displayed for the customer name and payment type. How can I write them properly?</p>