hi guys!

i need help ! what's wrong of this code??
this program will input five names and will output the five names i inputed. but when i run this program and i inputed a five names. It couldn't give me the exact answer.. the output should be this:
please enter your name:
john smith
wilson brent
andy smith
gibson rudriguez
francis moore

output:
name list
john smith
wilson brent
andy smith
gibson rudriguez
francis moore

{                                                                             
char name[5][50];                                                              
char i =0, j=0;                                                                 
clrscr();                                                                   
cout<<"please enter your name:\n";                                          
  for(i=0;i<5;i++)                                                           
  {                                                                          
     cin.getline(name[i], 50);    
   }                                        
  for(j=0;j<5;j++) 
      {
      cout<<"The name List\n"<<name<<"\n";  
        }
  cin.get();
  return 0;
 }
for(j=0;j<5;j++) 
{
      cout<<"The name List\n"<<name<<"\n";  
}

somehow i didn't feel like replying because it seems like you didn't try to debug this on your own even once before shooting a post here. But just in case its genuine, while outputting also you need to use the subscripts, like name[j].

next time please post well indented code with code tags for specific language.

thanks for this...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.