cout << "n4. How much does an " << item << " weigh in " << unit << "? Type here: ";
cout.flush();//promt is displayed immediately
cout << "n *Note that the format for entering the weight must only contain numerical digits";
cout << "n *The number can either be typed as a whole number or decimal number (e.g 1234 or 1234.0000)n";
//Need something to reset the cursor back to "Type here: "
cin >> weight;
Notice the first cout in the block. I want the text cursor to revert to that spot (“Type here: cursor“) wilst the cout asterick statements printed prior to when cin waits for user input. My idea is there is some kind of variable that stores a save state of the cursor, which would be declared after the first cout statement in my code snippet. For context, I am working through a linux terminal. From a post provided by the Community Bot, I looked up SetConsoleCursorPosition(), and learned that is a Windows-specific function.
How could I save the state of the text cursor and then “call” the cursor to “load” the saved state of the cursor?
Still a beginner, so I’m grateful for any suggestions. I believe I sufficiently made clear what I need to accomplish.
InfoCorsair is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.