hello sorry if i had posted something that is already available coz i've search this but to no avail.what i want to do is assign the q key to quit the program what is the command line?
hello sorry if i had posted something that is already available coz i've search this but to no avail.what i want to do is assign the q key to quit the program what is the command line?
http://cboard.cprogramming.com/showt...threadid=31169
Tells you how to do this and similar things.
L33t sp3@k sux0rz (uZ it t@k3s 10 m1|\|ut3s 2 tr@nzl@te 1 \/\/0rd & th3n j00 h@\/3 2 g3t p@$t d@ m1zpelli|\|gz, @tr0(i0u$ gr@mm@r @|\|d 1n(0/\/\pr3#3|\|$1bl3 $l@|\|g. 1t p\/\/33nz j00!!
Speling is my faverit sujekt
I am a signature virus. Add me to your signature so that I may multiply.
what i want to do is that assigning a quit key before the user key in any optionthat had been given.if can where should i put it?tried the swith but both default interfered with one another.Code:#include <stdio.h> #include <iostream.h> #include <conio.h> using namespace std; int main() { char q,x; int choice = 0; int nilai; int jumlah; char b; a: cout << endl << "***********************************************************" << endl << "*Masukkan Jumlah Jualan Anda *" << endl << "*Anda Boleh Memilih Dari Salah Satu Pilihan Di Bawah: *" << endl //welcome msg i written it in my language << endl << "*1 Jika Jumlah Anda 5000 Pilih Opsyen Ini *" //1st option for the user << endl << "*2 Jika Jumlah Anda 6000 Pilih Opsyen Ini *" //2nd option << endl << "*3 Jika Jumlah Anda 7000 Pilih Opsyen Ini *" //3rd option << endl << "*4 Jika Jumlah Anda Lebih Dari 7000 Pilih Opsyen Ini *" << endl //4th option << endl << "*Masukkan Pilihan Anda: *" << endl; cin >> choice; //where user key in the input switch(choice) { case 1: cout << endl << "Gaji Anda Ialah RM 650" << endl; break; case 2: cout << endl << "Gaji Anda Ialah RM 740" << endl; break; case 3: cout << endl << "Gaji Anda Ialah RM 830" << endl; break; case 4: cout << endl << "Masukkan Jumlah Jualan Anda \n "; cin >> nilai; if (nilai > 0) jumlah=nilai/100*9+200; cout << "Gaji Anda Ialah: \n RM"; cout << jumlah; break; default: cout << endl <<"Anda Telah Memasukkan Pilihan Yang Salah." << endl; } cout<<"\n****************************************************\n"; cout<<"\nAdakah Anda Ingin Teruskan Aplikasi?[y/n]:"; //asking whether user wants to quit or not cin>>b; if(b=='y'||b== 'Y') goto a; else return 0; }
Originally posted by vVv
I don't understand your problem. Maybe make choice a ``char''
And then replace the switch cases through ascii digits (case '1', case '2', etc).Code:cin >> choice; //where user key in the input if( choice == 'q' ) return 0;
how do i set through ascii?
whenevr i set q as my quit button
the program suddenly loop continously until i click the x button
waht if i want to print out the output?what is the code?and i heard about "black window" what is that?from what i've heard it got something to do with printing and a code,if theres such a thing what is it?