This is something i offer if this is what your looking for. Please it is not the best, it is for demo.
The program has 3 calls to functions. Here the functions only print a message to screen. But, using the switch statement you can do a 'reserve keybaord functions '...
If you have any questions, please do return to this thread to ask them... Thank you.
j@ck_
#include <iostream>
#include <cstdlib>
using namespace std;
void saldot(); // Function ( all 3 ) prototypes
void mosdot();
void dordot();
do {
cout << "Enter function number ( 1 - 3 ) (4)to exit: " ;
cin >> system; // enter value
switch(system) // ............ start switch
{
case WState_A: // ..... Checks for first value
saldot(); // ... calls the function
break; // If value one then ends here
case WState_B: // ..... Checks for second value
mosdot(); // ... calls the function
break; // If value two then ends here
case WState_C: // ..... Checks for thrid value
dordot(); // ... calls the function
break; // If value three then ends here
default: // If not any of the above then this massage will print to screen.
cout << "The Number "<< system << " Is not a Function. \n" ;
break;
} // ........................ end switch
}while(system != 4);
return 0;
} // ends main()
void saldot() // Function definition
{
cout <<"You called saldot Function...\n";
}
void mosdot() // Function definition
{
cout <<"You called mosdot Function...\n";
}
void dordot() // Function definition
{
cout <<"You called dordot Function...\n";
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Although a little more advanced than nessairy, J@ck's solution should work.
I have a menu I created once that is very versitile if you would like to try it.
Curtis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there anyway to reserve keybaord functions in C++?? as in...Press 1 to do....press 2 to do...etc. Thanks
Like a menu? Please be more precise.
Curtis
Yes....just like a menu
This is something i offer if this is what your looking for. Please it is not the best, it is for demo.
The program has 3 calls to functions. Here the functions only print a message to screen. But, using the switch statement you can do a 'reserve keybaord functions '...
If you have any questions, please do return to this thread to ask them... Thank you.
j@ck_
#include <iostream>
#include <cstdlib>
using namespace std;
void saldot(); // Function ( all 3 ) prototypes
void mosdot();
void dordot();
int main( )
{
enum system { // ....... starts enum
WState_A = 1,
WState_B,
WState_C,
quit
}; // ....................... ends enum
int system = 0 ; // Variable
do {
cout << "Enter function number ( 1 - 3 ) (4)to exit: " ;
cin >> system; // enter value
switch(system) // ............ start switch
{
case WState_A: // ..... Checks for first value
saldot(); // ... calls the function
break; // If value one then ends here
case WState_B: // ..... Checks for second value
mosdot(); // ... calls the function
break; // If value two then ends here
case WState_C: // ..... Checks for thrid value
dordot(); // ... calls the function
break; // If value three then ends here
default: // If not any of the above then this massage will print to screen.
cout << "The Number "<< system << " Is not a Function. \n" ;
break;
} // ........................ end switch
}while(system != 4);
return 0;
} // ends main()
void saldot() // Function definition
{
cout <<"You called saldot Function...\n";
}
void mosdot() // Function definition
{
cout <<"You called mosdot Function...\n";
}
void dordot() // Function definition
{
cout <<"You called dordot Function...\n";
}
Although a little more advanced than nessairy, J@ck's solution should work.
I have a menu I created once that is very versitile if you would like to try it.
Curtis
Sure Curtis, that would be appreciated, just learning C++, and any ideas that I can see and try out is a good thing.
Thanks
I have some changes to make to it, and I will write a test program for it. Then I will post a link one the "Programs" thread.
Curtis
http://sourceforge.net/forum/message.php?msg_id=1786589
Curtis