Unfortunately, since there are no standard ways to clear the screen or place the cursor at any particular point, that sort of thing becomes difficult. It's more difficult if you want the code to be portable, but then again maybe you dont want that. Supposing we have a clear screen function, here is a possiblity:
Code:
string items[3]={"Do something","Do something else","Quit"};
int i;
int currentlyselected;
char k;
do
{
ClearScreen();
for (i=0;i<3;i++)
{
if (i==currentlyselected)
cout << "* ";
else
cout << " ";
cout << items[i] << endl;
}
cin.get() >> k;
switch (k)
{
case '8':
if (i==0) i=2;
else i--;
break;
case '2':
if (i==2) i=0;
else i++;
break;
case 13:
break;
default:
break;
}
} while (k!=13);
That code was written entirely in this edit box here, so don't give me crap about it not working. It's a close approximation of how you could implement this sort of menu system. You'll have to work out how to clear the screen in Linux, I have no idea how to do it.