hello guys
im trying to read input from keyboard including space
so i coded that;
1 2 3 4 5 6 7 8 9 10 11
int main() {
int ks,i,j,is;
char nokta[10];
cout<<"Enter N: ";
cin>>ks;
for (i=0;i<ks;i++){
cout<<"i= "<<i<<endl;//check line for i
cout<<"Enter X,Y: ";
cin.getline(nokta,10,'\n');
}
}
the problem is, the output doesn't wait for me to input value.
the output is:
Enter N: 4
i= 0
Enter X,Y: i=1
Enter X,Y: 4 5
i=2
Enter X,Y: 5 6
i=3
Enter X,Y: 6 7
p.s.: underlined texts are keyboard input.
as you can see, while i=0 it doesnt let me to input any value and it skips to next value of i (i=1).
on the other hand, if i use cin>>nokta; instead of cin.getline, this time stupid c++ doesnt let after the space chr. for ex: if i input "4 5", it takes only "4".