How Do i make a button that "skips" and Ends the file?
Jun 28, 2015 at 8:27am UTC
hi there, i made myself a little calculator , BUT when you start it, it asks for your name
and i want to do that when you type the button: "K" It will SKIP To the actual calculator,
so i made another thing called
void actualcalculator();
and i puted there all the MAIN just without the username.
but how do i make the button?,
thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
#include <iostream>
#include <string>
//LAST UPDATED ON 28.6.2015
/*FUTURE PLANS
1. SKIP TO CACULATOR BUTTON
2. more features.*/
using namespace std;
//--------------------FUTURE PLANS 1.
/* void actuallycalculator()
{
int a;
int b;
int sum;
int amb;
int akb;
int adb;
cout << "Please Select A Number: \n";
cin >> a;
cout << "Please Select Another Number: \n";
cin >> b;
sum = a + b;
amb = a - b;
akb = a * b;
adb = a / b;
cout << a << " + " << b << " = " << sum << endl;
cout << a << " - " << b << " = " << amb << endl;
cout << a << " * " << b << " = " << akb << endl;
cout << a << " / " << b << " = " << adb << endl;
cin.ignore();
cin.get();
}
*/
void username()
{
string user_first_name;
string user_second_name;
cout << "Hi There!\n" ;
cout << "What Is Your First Name?\n" ;
cin >> user_first_name;
cout << "What Is Your Second Name?\n" ;
cin >> user_second_name;
string user_full_name = user_first_name + " " + user_second_name;
cout << "Hi " << user_full_name << "\n" ;
}
void rating()
{
string rating;
cout << "Before You Leave \n" ;
cout << "How Much Do You Rate This Calculator? \n" ;
cin >> rating;
if (rating == "10" )
{
cout << "wow! thanks!\n" ;
}
}
int main()
{
username();
int a;
int b;
int sum;
int amb;
int akb;
int adb;
cout << "Please Select A Number: \n" ;
cin >> a;
cout << "Please Select Another Number: \n" ;
cin >> b;
sum = a + b;
amb = a - b;
akb = a * b;
adb = a / b;
cout << a << " + " << b << " = " << sum << endl;
cout << a << " - " << b << " = " << amb << endl;
cout << a << " * " << b << " = " << akb << endl;
cout << a << " / " << b << " = " << adb << endl;
rating();
cin.ignore();
cin.get();
}
Last edited on Jun 28, 2015 at 8:29am UTC
Jun 28, 2015 at 11:33pm UTC
Button? What button?
Jun 29, 2015 at 1:32am UTC
To make a button you need to use a graphics library.
In the meantime use the keyboard as a set of "buttons".
Topic archived. No new replies allowed.