Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Breakfast Menu
//g++ 7.4.0 //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; #include <iostream> using namespace std; void package1(int &, int &); void package2(int &, int &); void package3(int &, int &); void package4(int &, int &); void printorder(int,int); void package1(int& rqty, int& rprice) { cout<<"Package 1 has 2 parathas, 1 scrambled egg and 1 chai. It costs Tk 50."; cout<<"Place your order here: "; cin>>rqty; cout<<"And unit price: "; cin>>rprice; } void package2(int& rqty, int& rprice) { cout<<"Package 2 has 2 rotis, 1 dal and 1 chai/coffee. It costs Tk 40."; cout<<"Place your order here: "; cin>>rqty; cout<<"And unit price: "; cin>>rprice; } void package3(int& rqty, int& rprice) { cout<<"Package 3 has 2 slices of bread, jelly and 1 egg. It costs Tk 35."; cout<<"Place your order here: "; cin>>rqty; cout<<"And unit price: "; cin>>rprice; } void package4(int& rqty, int& rprice) { cout<<"Package 4 has 2 toasts, 1 boiled egg, 1 gravy and 1 chai. It costs Tk 100."; cout<<"Place your order here: "; cin>>rqty; cout<<"And unit price: "; cin>>rprice; } void printorder(int qty, int price) { cout<<"You have ordered "<<qty<<" units.\n"; cout<<"And total bill is "<<qty*price <<" taka only."; } int main() { void (*pFunc) (int&, int&); bool fQuit=false; int qty=0; int price =0; int choice; while (fQuit==false) { cout <<"(0)Quit (1)Package1 (2)Package2 (3)Package3 (4)Package4."; cin>>choice; switch(choice) { case 1: package1(qty, price); break; case 2: package2(qty, price);break; case 3: package3(qty, price); break; case 4: package4(qty, price); break; default: fQuit=true; break; } if (fQuit) break; pFunc(qty, price); printorder(qty,price); } }
run
|
edit
|
history
|
help
0
BinSearch
Search in a rotated sorted array two methods
Hashing
1st
lock
ISPrime
Microsoft - # of fragments (optimised)
minmax
XML parsing with regex
LP