Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Breakfast
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////// //this code is created by Rezaul Hoque //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 <iostream> #include <string> using namespace std; class Breakfast {//abstract base class that has more than two virtual functions public: virtual void begin()=0; virtual void finish()=0; }; class Paratha : public Breakfast { public: void begin () { cout<<"Take half tea cup of flour, one spoon of butter, one cup of hot water, a pinch of salt and mix them to prepare dough.\n";} void prepare () { cout<<"Cut the dough into three equal pieces, prepare three equal sizes of chapati by pressing and rolling with a rondelle.\n"; } void cook() { cout<<"Put the frying pan on stove;lit the stove;spread some oil/ghee and fry the chapattis one by one.\n"; } void finish (){ cout<<"Place the parathas on a plate and mop up the oil with a tissue.\n\n"; } }; class Lemonade : public Breakfast { public: void begin() { cout<<"Take one slice of lemon; squeeze it into a glass; pour water into it; add some salt and sugar.\n";} void stir() {cout<<"Stir the mix for one minute; drop some ice cube.\n";} void finish (){ cout<<"Draw a roaster and place it on the table.\n\n";} }; class Chai: public Breakfast { public: void begin () { cout<<"Take a tea bag; place it on a cup.\n";} void add(){ cout<<"Add hot water, milk and sugar.\n";} void finish (){ cout<<"Voila, your perfect tea.\n\n";} }; class Egg: public Breakfast { public: void begin(){ cout<<"Crack an egg on the pot.\n";} void chop(){ cout<<"Chop some onion, garlic, chili and coriander.\n";} void add(){ cout<<"Add the chopped things on the pot. Add some milk and butter.\n";} void beat(){ cout<<"Now beat it.\n";} void stove(){ cout<<"Light on the stove and place the frying pan on it.\n";} void oil (){cout<<"Add some oil over the hot pan.\n";} void cook(){ cout<<"Pour the mixture on the pan and leave it there for 2 minutes.\n";} void finish(){ cout<<"Two minutes later place it on a plate and don't forget to add salt.\n\n";} }; int main() { cout <<"It's time for breakfast:\n\n"; Egg o; Lemonade l; Paratha p; Chai t; cout <<"Start the day with nimbu paani:\n"; l.begin(); l.stir(); l.finish(); cout <<"Now prepare the egg:\n"; o.begin(); o.chop(); o.add(); o.beat(); o.stove(); o.oil(); o.cook(); o.finish(); cout<<"Now make the parathas:\n"; p.begin(); p.prepare(); p.cook(); p.finish(); cout<<"Now serve the tea:\n"; t.begin(); t.add(); t.finish(); cout <<"\n"; cout<<"Hope you enjoy the breakfast."; return 0; }
run
|
edit
|
history
|
help
0
reverse function
<string> Indirect include of <errno.h> with gcc
Hi
Matrix multiplication naive approach
vector fr
wealth of banks
aaaaaaaaaaaa
Microsoft - # of fragments (optimised)
Stock buy/sell
Grundy Number