Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Stream9
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////// //Stream9 //this code is created by Rezaul Hoque on July 27,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //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 <fstream> #include <iostream> #include <iomanip> #include <string> #include <strstream> //stream manipulator std::ostream& l(std::ostream& os) { return (os<<"\n"); } void fill(char c) { std::cout.width(40); std::cout.fill(c); std::cout<<l; } void lunch() { int a=10,b=10,c=10,d=40; fill('*'); std::cout.setf(std::ios::left); std::cout.fill(' '); std::cout.width(25); std::cout<<"\tMenu"<<"Price"<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tRice(1½ plates)"<<"Tk"<<a*1.5<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tLentil Soup(1 cup)"<<"Tk"<<c*1<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tMalabar Spinach(1 plate)"<<"Tk"<<b*1<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tRita fish(1 plate)"<<"Tk"<<d*1<<l; std::cout.setf(std::ios::right); std::cout.fill(' '); std::cout.width(25); std::cout<<"\tTotal "<<"Tk"<<(a*1.5+b*1+c*1+d*1)<<l; fill ('*'); } void dinner() { int a=10,b=20,c=40; fill('*'); std::cout.setf(std::ios::left); std::cout.fill(' '); std::cout.width(25); std::cout<<"\tMenu"<<"Price"<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tNaan(2 pieces)"<<"TK "<<a*2<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tLabra(1 plate)"<<"TK "<<b*20<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tDal Makhani(1 plate)"<<"TK "<<c*1<<l; std::cout.setf(std::ios::right); std::cout.fill(' '); std::cout.width(25); std::cout<<"\tTotal "<<" TK "<<(a*2+b*1+c*1)<<l; fill ('*'); } void breakfast() { int a=5,b=50,c=15; fill('*'); std::cout.setf(std::ios::left); std::cout.fill(' '); std::cout.width(25); std::cout<<"\tMenu"<<"Price"<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tRoti(3 pieces)"<<"TK "<<a*3<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tChicken soup(1 cup)"<<"TK "<<b*1<<l; std::cout.setf(std::ios::left); std::cout.fill('.'); std::cout.width(25); std::cout<<"\tMalai Tea(1 cup)"<<"TK "<<c*1<<l; std::cout.setf(std::ios::right); std::cout.fill(' '); std::cout.width(25); std::cout<<"\tTotal "<<" TK "<<(a*3+b*1+c*1)<<l; fill ('*'); } void Menu(std::string na,int dineTime,int loc ){ static std::stringbuf buf; static std::ostream o(&buf); o<<" Welcome "<<na<<" to ***HomeMade Resto***"<<l; if(loc==1) o<<"Please note,TK 10 transport charge will be added for food delivery in Mirpur."<<l; else if(loc==2) o<<"Please note,TK 50 transport charge will be added for food delivery in Uttara."<<l; else if(loc==3) o<<"Please note,TK 50 transport charge will be added for food delivery in Banani and Gulshan."<<l; else if(loc==4) o<<"Please note,TK 100 transport charge will be added for food delivery in Puran Dhaka."<<l; else o<<"Sorry,our service is not available there at the moment."<<l; std::cout<<buf.str()<<l; if(dineTime==1) breakfast(); else if(dineTime==2) lunch(); else if(dineTime==3) dinner(); else std::cout<<"Sorry,no other menu available! "<<l; } int main() { fill('&'); Menu("Hao Mau Khaon", 3,4); fill('&'); return 0; }
run
|
edit
|
history
|
help
0
Camel case
single_digit
qsort
ttt
Heap DS and Heapsort
Problem: binary
CyclicExpression Checker
Preference List
motores
shell sort