I would first verify with your teacher whether this is really what he wants, because that is not easy to do, in fact, you probably can't do it without an extended IO library (such as conio.h or curses.h).
I would suggest you just avoid the problem and do this:
// input number of sheep in each field
cout << " Enter the number of sheep sheared from 3 fields for 2008 : ";
cin >> numberOfSheep1 >> numberOfSheep2 >> numberOfSheep3;
Then the user can enter the three fields, separated by a space.
mike_2000_17
21st Century Viking
3,136 posts since Jul 2010
Reputation Points: 2,050
Solved Threads: 625
Skill Endorsements: 41
If you still wish to do all the outputs and inputs on the same line, the '\b' character might work. You could possibly use it to delete the newline character. Just a thought.
One way I know for sure works though is using the Windows.h SetConsoleCursorPosition(). See:
http://www.adrianxw.dk/SoftwareSite/index.html
Or you could try looking up the getch() function to get input w/o waiting for ENTER key.
Hope this helps!
Labdabeta
Practically a Master Poster
614 posts since Feb 2011
Reputation Points: 27
Solved Threads: 31
Skill Endorsements: 1