consider the following program segment:
char a, b;
cin>>a; cin>>b;
cout<<a<<" "<<b;
if we input:
2(enter)
3(enter)
2 gets stored in a and 3 gets stored in b as expected
but if we input:
23(enter)
the same thing happens. can anyone tell me why this happens?
Is there any way i can stop this from happening?
if we input:
2(enter)
3(enter)
2 gets stored in a and 3 gets stored in b as expected
but if we input:
23(enter)
the same thing happens. can anyone tell me why this happens?
computer is stroing 2 in a,or i misunderstand you?
when i said the same thing happens, i meant that 2 gets stored in a and 3 gets stored in b but
i don't want to allow the user to input both values in one go.
i want each input to be separated by (enter). is there a way to do so?