Function Key Help

This is a discussion on Function Key Help within the C++ Programming forums, part of the General Programming Boards category; Ok Nevermind Guys I Got It Done Somehow...lol Code: //Written By : Andrew Bomstad //"Function Keys" #include<iostream> #include<conio.h> #define cls ...

  1. #1
    Fallen AndyBomstad's Avatar
    Join Date
    Jan 2005
    Posts
    52

    Function Keys

    Ok Nevermind Guys I Got It Done Somehow...lol

    Code:
    //Written By : Andrew Bomstad
    //"Function Keys"
    
    #include<iostream>
    #include<conio.h>
    
    #define cls system("cls");
    #define pause system("pause");
    
    using namespace std;
    
    int f1();
    int enterinfo();
    
    int main()
    {
        cls
        int sel;
        cout<<"                    F1<HELP>       F2<Enter Info>       ESC<Quit>\n";
        cout<<endl<<endl<<"1) - Check Database\n";
        cout<<"2) - Edit Database\n";
        cout<<endl<<"Please Make Selection : ";
    
        int ret;
                   ret = getch();         //get the ASCII value of the key pressed
                                
                   if (ret == 27)
                      exit(0);
                   if (ret == 0)
                   {
                      ret = getch()+256;
    
                      switch(ret)                   //switch between various values of 'ret'
                      {                                                        
                        case 315:
                             f1();
                             break;
                        case 316:
                             enterinfo();
                             break;
                        }
                        }else
                        {
                             switch(ret)
                             {
                                        case '1':
                                             cls
                                             cout<<"----------------------Check-Database------------------\n";
                                             cout<<endl<<endl<<"         !--Feature-Incomplete--!\n\n\n";
                                             pause;
                                             main();
                                        case '2':
                                             cls
                                             cout<<"------------------------Edit-Database------------------\n";
                                             cout<<endl<<endl<<"         !--Feature-Incomplete--!\n\n\n";
                                             pause;
                                             main();
                                        default:
                                                main();
                                                break;
                                             }
                                             }
                                                
        return 0;
    }
    
    int f1()
    {
        cls;
        cout<<"-----------------------------HELP-ME-----------------------------";
        cout<<endl<<endl<<"               You Are Now In The HELP Window"<<endl;
        pause
        main();
    }
    
    int enterinfo()
    {
        cls
        char name[50];
        char number[50];
        cout<<"----------------------------Enter-Info---------------------------";
        cout<<endl<<endl<<"\n\nPlease Enter Your Name: ";
        cin.getline(name,sizeof(name));
        cout<<endl<<"Please Enter Your Phone Number: ";
        cin.getline(number,sizeof(number));
        cls
        cout<<"----------------------------Enter-Info---------------------------";
        cout<<endl<<endl<<"\n\nYour Name Is: "<<name<<endl;
        cout<<"Your Phone Number Is: "<<number<<endl;
        pause
        main();
    }
    there ya go
    Last edited by AndyBomstad; 05-05-2005 at 03:03 AM. Reason: Fixed It

  2. #2
    *this
    Join Date
    Mar 2005
    Posts
    498
    Check out the ASCII standard values for F1, F2, and Esc, and run a switch to select a function based on input.
    Last edited by JoshR; 05-04-2005 at 10:31 PM.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,630
    Replies Here: Control Keys

    After reading the FAQ, check out the Announcements.

    gg

  4. #4
    Fallen AndyBomstad's Avatar
    Join Date
    Jan 2005
    Posts
    52
    ive been looking around for the ASCII for the "F" keys but i cant find it i can find ESC but not the functions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  4. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  5. Registery with api?
    By ismael86 in forum Windows Programming
    Replies: 1
    Last Post: 05-14-2002, 10:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21