Enter your address: Sample1
//it needs 2 enter to show the sample1 and since im in infinite loop, if you enter another value the Enter your address will show first before your latest inputted value.. can anyone help me to read getline using one enter only. Thanks in advance
Please show a small sample of your actual output, and what you actually would like your output to be. I get the following output, which is what I would expect when looking at your code.
Enter your address:234 West South Street
234 West South Street
Enter your address:431 South West Street
431 South West Street
Enter your address:
Also note that you shouldn't need to flush() the output stream, the call to getline() should force a flush of the output stream all by it's self unless you're using a non-standard conforming compiler, or you have messed with the stream interfaces. Since you are using void main() it is possible that your compiler doesn't conform to the standard in this situation as well.
Enter your address:Philippines
Philippines//needs 2 enter
Enter your address:America
Enter your address://after i enter america, this is the next output
//and if i input another value, for example Australia, after i enter this is the output
America
Enter your address:
Note: i am using visual c++ editor not visual studio framework.