# Code for pressing a button

 Miguel Bastos · April 20, 2015 HeyI'm a newbie at programming so i started learning it on the internet and I'm trying to improve my skills , but i've got a problem that is , i want to make a calculator , i decided that my calculator will only have 3 operations , + ; - ; * .I want to open the console and it will give me a message about what kind of operation i want to do , addition , subtraction or multiplication.There is the problem , i cant define a rule that if i press the F1 key it will stand for the addition operation , if i press the F2 it will stand the subtraction , and if i press F3 it will stand for multiplication.I'm saying F1 , F2, F3 but it can be any Key like a , b ,c whateverI'll let here my code ``#include using namespace std;int F1(int x, int y){cout  x;cout  y;int answer = x + y;return answer;}int F2 (int z, int c){cout  z;cout  c;int minusanswer = z - c;return minusanswer;}int F3 (int v, int b){cout  v;cout  b;int multipanswer = v * b;return multipanswer;}``

## Replies

 ♦Avishka RJ ♦™ · April 24, 2015 For more info::http://www.softwareandfinance.com/Turbo_C/bioskey.html ♦Avishka RJ ♦™ · April 24, 2015 ♦Avishka RJ ♦™ · April 24, 2015 #include using namespace std;double answer;void addition(double x,double y);void subst(double x,double y);void multiplication(double x,double y);void division(double x,double y);int main(){    double num1,num2;    char operater;    cout<<"Enter a number"<> num1;    cout<<"Enter a number"<>num2;    cout<<"Press + for Addition"<>operater;    if(operater==43){        addition(num1,num2);    }    else if(operater==45){        subst(num1,num2);    }    else if(operater==42){        multiplication(num1,num2);    }    else if(operater==47){        division(num1,num2);    }    else{        cout<<"Invalid operater"<using namespace std;int F1(int x, int y){ cout << "Enter a number: " << endl; cin >> x; cout << "Enter a number: " << endl; cin >> y; int answer = x + y; return answer;}int F2 (int z, int c){ cout << "Enter a number: " << endl; cin >> z; cout << "Enter a number: " << endl; cin >> c; int minusanswer = z - c; return minusanswer;}int F3 (int v, int b){ cout << "Enter a number: " << endl; cin >> v; cout << "Enter a number: " << endl; cin >> b; int multipanswer = v * b; return multipanswer;}int main(){ cout << "What Type of calculation do you wanna make? " << endl; cout << "F1--> addition   " << "   F2-->subtraction   " << "   F3-->multiplication" << endl; if (F1) F1(1, 1); else if (F2) F2(2, 2); else if (F3) F3(2, 2); return 0;} ♦Avishka RJ ♦™ · April 20, 2015 if you need to post full code just use "insert a quote" option I also feel there's a proble in "code" ♦Avishka RJ ♦™ · April 20, 2015 just checkout below site.use that ascii code with IF statements.http://www.thecodingforums.com/threads/re-ascii-code-for-functions-keys-f1-f12-and-tab-key.277457/ Miguel Bastos · April 20, 2015 I couldn upload all the code i don't know why  , same thing can't upload all the code here too..``#include using namespace std;int F1(int x, int y){cout  x;cout  y;int answer = x + y;return answer;}int F2 (int z, int c){cout  z;cout  c;int minusanswer = z - c;return minusanswer;}int F3 (int v, int b){cout  v;cout  b;int multipanswer = v * b;return multipanswer;}int main(){cout``
• 1

## C++

126,400 followers