Having trouble solving the following problem:
Using array, input a name and it should output the same name. I am required to use for loop. Any solutions? Greatly appreciate it.
This is what i have so far:
void main()
{
char name[10];
cout<<"enter a name:";
for (int a=0;a<=5;a++){
cin>>array[a];
}
for (int j=0; j<=5;j++){
cout<<array[5];
}
}
Using array, input a name and it should output the same name. I am required to use for loop. Any solutions? Greatly appreciate it.
This is what i have so far:
void main()
{
char name[10];
cout<<"enter a name:";
for (int a=0;a<=5;a++){
cin>>array[a];
}
for (int j=0; j<=5;j++){
cout<<array[5];
}
}