ok im trying to write a program using 2 Char Arrays of about size 10, and i want the first to be a users first name and the 2nd to be their last
once they enter both first and last i want it to desplay like this:
BUCKET #0 = A
BUCKET #1 = N
BUCKET #2 = D
BUCKET #3 = Y
BUCKET #0 = B
BUCKET #1 = O
BUCKET #2 = M
BUCKET #3 = S
BUCKET #4 = T
BUCKET #5 = A
BUCKET #6 = D
i do NOT want it to show up like this :
BUCKET #0 = A
BUCKET #1 = N
BUCKET #2 = D
BUCKET #3 = Y
BUCKET #4 =
BUCKET #5 =
BUCKET #6 =
BUCKET #7 =
BUCKET #8 =
BUCKET #9 =
BUCKET #0 = B
BUCKET #1 = O
BUCKET #2 = M
BUCKET #3 = S
BUCKET #4 = T
BUCKET #5 = A
BUCKET #6 = D
BUCKET #7 =
BUCKET #8 =
BUCKET #9 =
the following code will display this :
BUCKET #0 = A
BUCKET #1 = N
BUCKET #2 = D
BUCKET #3 = Y
BUCKET #4 =
BUCKET #5 =
BUCKET #6 =
BUCKET #7 =
BUCKET #8 =
BUCKET #9 =
press any key to continue....
And Nothing more, it doesnt even show the last name....
and i know its somthing with the input buffer or checking to see if it found the EOF, but i dont know how to go about doing thisCode:#include<iostream> using namespace std; int main() { char first[10]; char last[10]; int i = 0 ; cout<<"Please Enter Your First Name: "; cin>>first; cout<<"Please Enter Your Last Name: "; cin>>last; while(i <= 9) { cout<<endl<<"Bucket #"<<i<<" = "<<first[i]<<endl; i++; } while(i <= 9) { cout<<endl<<"Bucket #"<<i<<" = "<<last[i]<<endl; i++; } system("pause"); }