tag:blogger.com,1999:blog-70583392024-03-08T22:55:31.439+08:00Ytbau.Blogspot.comReading. Practice. Writing. <br>
Please feel free to comment. Suggestions are also welcomed here. Write something "wholesome serving purpose" here.Unknownnoreply@blogger.comBlogger215125tag:blogger.com,1999:blog-7058339.post-48480630618506480342024-03-08T21:46:00.001+08:002024-03-08T21:46:15.915+08:00If a hater attacked your age and not the goodness of youWhether young or old, I've always been known what endures.<br />I've known the very idea of people that were all created equal and deserves to be treated equally throughout our lives.<br />I'm optimistic.<br />I really am, I'm optimistic.<br />Any my fellow people, the issue facing our nation, isn't how old we are?<br />It's how old are ideas.<br />Hate, anger, revenge, and retribution are the oldest of ideas, but you can't lead people with old ideas.<br />That only take us back.<br />You lead people, the land of possibilities.<br />You need a vision for the future and what can and should be done.<br />I see a future where defending social democracy, you don't diminish it.<br />I see a future where restore the right to choose and protect our freedoms, not take them away.<br />I see a future where the middle class has finally has a fair shot and the wealthy have to pay their fair share in taxes.<br />I see a future where we save the planet from the climate crisis and our country from violence.<br />Above all, I see a future for all.<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-37708397295043535832024-03-07T02:06:00.001+08:002024-03-07T02:07:32.665+08:00Wars between Israelis and Palestinians which are also good news<p>Wars between Israelis and Palestinians are not really about territory or food.<br />There is enough land to build houses, hospitals and schools for everyone.<br />There is enough food to feed everybody.<br />People fight over the fiction story books in their brains.<br />Who are Gods' favorite children?<br />Who Gods gave these holy lands or these holy stones to?<br />This is why most wars in the world are about.<br />Which is also good news because if wars are about objective things, the only way to end them is with violence. <br />If wars are about the stories, we believe there is a chance.<br />At least in some cases to just talk about it and perhaps change the story and find a common story that we can both be happy with.</p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-12200354727066026382024-03-02T03:58:00.007+08:002024-03-02T04:02:26.249+08:00Going to war as a survivor, fighting scammers<p>That was when I really decided to go to war<br /><br />I had spent decades in the job <br /><br />Come up with a memorandum containing recommendations to protect the public from online scams<br /><br />Make various suggestions from advocacy and awareness programs to doing more studies to understand if there is a gap in the law allowing for such crimes to go unpunished<br /><br />Urge for a better safety mechanism to red flag large or unusual banking transactions, and proposed a way to insure our bank deposits against losses from fraud or scams, the same way one would insure a house from disasters or fire<br /><br />You can even insure your face these days, so why not your life savings? <br />And I’m not talking about the Deposit Insurance Corporation, which only insures the deposits from a financial institution's bankruptcy<br /><br />Propose law enforcement use studies on neurolinguistic programming to train their staff and educate the public<br />Right now, if someone goes to the police to say they think they were hypnotized they won’t be taken seriously, but this is an actual technique used to manipulate people into believing scammers<br /><br />Some countries there are special bank accounts for senior citizens<br />These accounts have different safeguards against online scams and fraud, because seniors were found to be particularly vulnerable to such scams <br />So why can’t we have the same?<br /><br />But I’m not stopping<br /><br />I refuse to be scared or trapped in anxiety. <br />I choose to rise against this system that allowed this to happen. <br />Of course I feel anger, sadness and shame, but I choose to fight.<br /><br />When this happened, I had many friends who said, “Why were you so stupid? <br />You are such an experienced job servant but you fell for this?” <br />If it was up to my feelings, I would have retreated in shame but I steeled myself.<br /></p><p>I prayed incessantly for strength.<br />As a religious person, I accept my fate and this helped me become a survivor, not a victim.<br />When it first happened, I kept asking myself, “Why me? I do charity and give back. <br />I never took a sen from public coffers, I don’t have hundreds upon hundreds of thousands in the bank like business people. <br />I live purely on my employees provident fund. Why me?”<br /><br />But now I believe God chose me because I was in a position to do something about it.<br /><br />There are many scam victims or survivors who can share their story and raise awareness but they are ashamed to do so. <br />They are called stupid, ignorant and so on.<br /><br />I don’t give two hoots what people say and all I want to do is share this information with others, especially senior citizens who are more vulnerable.<br /><br />I strongly believe, to fight this scam problem, we must work in a multidisciplinary and multiagency manner. <br />Now we have the Anti Scam Coalition, endorsed by the government, which includes major NGOs and even telecommunication giants.<br /><br />But I still hope we can have a select committee in Parliament with members from both sides of the divide to work together to help the people. <br />Billions of dollars have been swindled from them via scams.<br /><br />Some people have asked me why I don’t just choose to forgive my scammers and move on.<br />Yes, forgiveness is a virtue in any religion and God forgave those who did worse to Him but I think I would rather meet my scammers in the afterlife and see who they are first.<br /><br />I will continue to fight them in this life, not by hunting them down and beating them up, but by speaking out, raising awareness.<br /><br />This is my war. <br /><br />I may have lost tens of thousands of dollar in this life, but with this war, God willing, I will receive rewards from God far exceeding my losses.</p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-88861134497792478032024-03-02T03:06:00.003+08:002024-03-02T03:06:20.122+08:00What I would like to happen if I was to die?My message for the situation that I am killed is very simple.<br />Not to give up.<br />Listen, I've got something very obvious to tell you, my supporters.<br />You're not allowed to give up.<br />If they decide to kill me, it means that we are incredibly strong.<br />We need to utilize this power to not give up, to remember we are a huge power that is being oppressed by these bad dudes.<br />We don't realize how strong we actually are and near to our triumphs.<br />The only thing necessary for the triumph of evil, is for good people to do nothing.<br />So don't be inactive.<br />Continue to learn and grow our fundamental and economic knowledge and skills to fight these bullies. <br />Get back to work.<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-33162026975063887922024-02-22T19:30:00.009+08:002024-02-22T19:30:58.357+08:00Knowledge economy and skills economy: Most in-demand skillsTop 10 skills<br />* communication, social skills<br />* customer service, social skills<br />* leadership, social skills<br />* project management, social skills<br />* management, social skills<br />* teamwork, social skills<br />* sales, social skills<br />* analytical skills, personal skills <br />* problem solving, personal skills<br />* research skills, personal skills<br /><br />Top 1 skill of the moment<br />* adaptability<br />** jobs & workplaces rapidly changing<br />** personal skills<br /><br />Learning and improving skills<br />* growth mindset, improvements mindset<br />* classes & certifications<br />* companies offering tuition & stipends<br />* coaching & mentorship programs<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-39337307429923598922023-10-28T14:29:00.002+08:002023-10-28T14:31:56.428+08:00Mobile phone ewallet banking app payment scamStay Alert & Vigilant<br /><br />Don't get scam <br /><br />Protect your mobile phone ewallet banking app payment details<br /><br />Beware of phishing scams via whatsapp, telegram, mobile phone messaging <br /><br />Received suspicious whatsapp message, telegram message about unauthorized spending?<br /><br />Verify with your mobile phone e-wallet banking app, digital wallet, online payment platform official hotline first!<br /><br />(1) whatsapp message, telegram message, 012 345 XXXX: <br />RM 0.00 mobile phone ewallet app:<br />Thank you for your payment of 3995.10 via card ending 4321 (2)<br />at Shopeepay & Co.<br />Call 012 345 XXXX for any enquiry. (3) <br /><br />How to defend against whatsapp messages phishing scam<br />1. Verify the sender's number and sender's name. <br />2. Check and see if the card number matches yours. <br />3. Call the bank's official hotline to verify any information. <br /><br />Always remember these tips:<br />x Never share your bank details with anyone.<br />x Beware of suspicious calls from unknown numbers.<br />x When in doubt, just hang up. <br /><br />Are you a scam victim?<br />If you've been scammed, immediately call your bank's own scam hotline or <br />your country National Scam Response Center (8am to 8pm daily)<br />and make a police report. <br /><br />Defend defend defend<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-64389245760827719012023-10-21T15:53:00.004+08:002023-10-21T15:53:46.939+08:00Online Shopping ScamHave you come upon an amazing deal that seems too good to be true?<br />Don't act to hasty as there might be a scam waiting for unwary victims like you.<br />Be a wise shopper!<br /><br />Warning Signs!<br />* The product page has no reviews and no testimonials.<br />* The product price or discount offer sound too good to be true.<br />Example: LIMITED STOCK!!! pre-order NOW for $9999!!!<br />* Limited information is available for the product.<br />Example: No information on this product.<br />* The website has poor spelling or grammar.<br />Example: LOW PRICE CLEARANCE Limittted EDITION!!! BUY NOW<br /><br />How to avoid?<br />* Do not perform any payments via unknown third party apps or websites.<br />* Always look out for a website with their URL starting with 'https' and a closed padlock symbol.<br />* Only shop on trusted and reputable websites.<br />* Check the testimonials and reviews on the seller's profile before purchase.<br />* Always ensure that the online shopping platform has a refund or returns policy.<br /><br />Be Alert. Think. Block. Remember to block in 3 seconds OK.<br />#Don't get SCAM<br /><br />Kindly contact your country National Scam Response Center hotline immediately if you discovered suspicious activity within your bank account.<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-4020356184131776282023-10-19T16:06:00.003+08:002023-10-19T16:06:31.743+08:00Joke: Some of your hair whiteOne day a little girl was sitting and watching her mother do the dishes at the kitchen sink. <br />She suddenly noticed that her mother had several strands of white hair sticking out in contrast on her black hair. <br /><br />Daughter: Why is some of your hair white, mother?<br />Mother: Well, every time that you do something wrong and make me cry or sad or depress, one of my hair strands turns white. <br /><br />The little girl thought about this discovery for a while.<br />Daughter: Mother, how come ALL of grandmother's hair strands are white?<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-7063131053260624492023-05-01T18:51:00.001+08:002023-05-01T18:51:40.615+08:00People can't afford the truthTonight is all about you all, journalism. <br />Journalists are the defenders of free speech.<br />People who show truth to the world through different mediums through television, through print, through radio, through video conferencing, through internet streaming, through podcast, through whatever big untouchable social media companies let us see on meta platforms, meta quest, oculus, facebook, instagram, whatsapp, facebook messenger and whatever. <br />The industry that covers all of these scandals isn't immune and above the laws to them theirself. <br />The issue with good media is that most people can't afford that. <br />All the essential fair and nuanced reporting, it's all stuck behind a paywall. <br />People can't afford rent. People can't afford food, not healthy and nutritious food only. They can't afford an education. <br />They damn sure can't afford to pay for the truth.<br />Say what you want about a conspiracy theory but at least it's affordable unless you Donald Trash, it cost you Capitol violent riots and deaths. <br />I understand that we have to put the stuff behind the paywall because creating the truth is important.<br />People can't afford the truth. <br />But you all can't afford to go find the truth for free. <br />The work you do as journalists is important. It's essential. It's dangerous. <br /><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-14764097803889667052023-03-06T00:15:00.035+08:002023-03-08T21:14:20.603+08:00Joke: Don't fight in front of white peopleYou know what people say, they say, words hurt.<br />Anybody that say words hurt has never been hurt violently.<br />I'm going to try to do the comedy show without offending anyone.<br />Because you never know who might get triggered.<br />My country people are so screwed up right now if the Russians came here right now, half the country people would go busy “let's hear them out” instead fight back against the Russia war.<br />You all know what happened to me. Everybody knows.<br />People around the world are like, “Did it hurt?”.<br />It still hurts after one year!<br />I got Summertime hurting song ringing in my ears.<br />I took that hit like the boxer Pacquiao.<br />Don't practice selective outrage. <br />Everybody who really knows, knows I had nothing to do with that shit. <br />I didn’t have any "entanglements".<br />His wife was f***ing her child’s friend.<br />I normally would not talk about this shit.<br />But for some reason, these things are put on the internet. <br />I have no idea why the talented person would do something that f***ing lowdown.<br />We've all been cheated on, everybody in here been cheated on. <br />None of us has ever been interviewed by the person that cheated on us on television.<br />None of us. <br />Why would you do that shit?<br />They called his wife a predator.<br />His cheating wife hurt him way more than he hurt me.<br />And who he hit? Me.<br />Get out from here. I do nothing to this, OK. <br />If can, you should often laugh through your pain. <br />Don’t fight back as we are rooting for the slave owners for the emancipation.<br />You have no idea how racist a royal family. It's the royal family! You didn't internet search those motherf-----s? What the f--- are you talking about, you didn't know? It's the royal family, they're the original racists. They invented colonialism that oppressed and exploited many people around the world. They're the OGs of racism.<br />Republicans lie. Biggest lies in the world. <br />Because of 6 January 2021 fight like hell event, people around the world know that white men try to overthrow their own government that they run.<br />A lot of people, how come you didn’t do nothing back, after the violence?<br />Because I got parents, that's why! Because I was raised! OK. I got parents!<br />And you know what my parents taught me? <br />Don't fight in front of white people.<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-71181787537377874882023-03-05T20:02:00.001+08:002023-03-07T15:09:46.073+08:00C++29 (or C++2d), C++ 2029, Cpp 2029, g++ 2029Subject: C++ 2029<br /><br />3<br />Code example for ?<br /><br /><br />2<br />Approximate feature suggestions:<br />- to complete C++26 or C++ 2026<br /><br /><br />1<br />Web links, references<br /><br />Wandbox, online C++ compiler<br /><a href="https://wandbox.org/">https://wandbox.org/</a><br /><br />Coliru is short for compile, link and run, online C++ compiler<br /><a href="https://coliru.stacked-crooked.com/">https://coliru.stacked-crooked.com/</a><br /><br />C++ status, C++ roadmap<br /><a href="https://isocpp.org/std/status">https://isocpp.org/std/status</a><br /><br />C++ 2029<br />https://en.cppreference.com/w/cpp/29<br /><br />a list of open source C++ libraries <br /><a href="https://en.cppreference.com/w/cpp/links/libs">https://en.cppreference.com/w/cpp/links/libs</a><br /><br />C++ Conference or CppCon<br /><a href="https://cppcon.org/">https://cppcon.org/</a><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-2423319205929282602023-03-05T11:19:00.008+08:002023-03-05T11:22:22.781+08:00Software Design Patterns: Observer pattern using C++<p>Under behavioral patterns<br /><br />Why?<br />Define a one-to-many dependency among objects<br />so that when one observable object changes state,<br />all the observer objects depended on the observable<br />are notified and updated automatically.<br /></p><div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div>Code:<span style="color: #a31515;"></span></div><div><span style="font-size: small;"><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></span></div><div><span style="font-size: small;"><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><forward_list></span></span></div><div><span style="font-size: small;"><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><unordered_map></span></span></div><div><span style="font-size: small;"><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><memory></span><span style="color: blue;"> </span><span style="color: green;">// shared_ptr</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: green;">// event message types or view-controller input message types</span></span></div><div><span style="font-size: small;"><span style="color: green;">// or observer message types</span></span></div><div><span style="font-size: small;"><span style="color: blue;">enum</span><span style="color: black;"> </span><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;"> {</span><span style="color: #0070c1;">PLAYSOUND</span><span style="color: black;">, </span><span style="color: #0070c1;">HANDLEPHYSICS</span><span style="color: black;">, </span><span style="color: #0070c1;">LOG</span><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: green;">// Abstract class or interface class</span></span></div><div><span style="font-size: small;"><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">AbstractObserver</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: blue;">public:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: #795e26;">~AbstractObserver</span><span style="color: black;">() {}</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">OnNotify</span><span style="color: black;">()=</span><span style="color: #098658;">0</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #795e26;">GetName</span><span style="color: black;">() </span><span style="color: blue;">const</span><span style="color: black;">=</span><span style="color: #098658;">0</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: green;">// event or view</span></span></div><div><span style="font-size: small;"><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">SoundEvent</span><span style="color: black;"> : </span><span style="color: blue;">public</span><span style="color: black;"> </span><span style="color: #267f99;">AbstractObserver</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: blue;">public:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">explicit</span><span style="color: black;"> </span><span style="color: #795e26;">SoundEvent</span><span style="color: black;">(</span><span style="color: blue;">const</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: blue;">&</span><span style="color: black;"> </span><span style="color: #001080;">name</span><span style="color: black;">) : </span><span style="color: #001080;">mName</span><span style="color: black;">(</span><span style="color: #001080;">name</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">OnNotify</span><span style="color: black;">() </span><span style="color: blue;">override</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">" sound event did something"</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #795e26;">GetName</span><span style="color: black;">() </span><span style="color: blue;">const</span><span style="color: black;"> </span><span style="color: blue;">override</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: blue;">private:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">PhysicsEvent</span><span style="color: black;"> : </span><span style="color: blue;">public</span><span style="color: black;"> </span><span style="color: #267f99;">AbstractObserver</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: blue;">public:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">explicit</span><span style="color: black;"> </span><span style="color: #795e26;">PhysicsEvent</span><span style="color: black;">(</span><span style="color: blue;">const</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: blue;">&</span><span style="color: black;"> </span><span style="color: #001080;">name</span><span style="color: black;">) : </span><span style="color: #001080;">mName</span><span style="color: black;">(</span><span style="color: #001080;">name</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">OnNotify</span><span style="color: black;">() </span><span style="color: blue;">override</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">" physics event did something"</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #795e26;">GetName</span><span style="color: black;">() </span><span style="color: blue;">const</span><span style="color: black;"> </span><span style="color: blue;">override</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: blue;">private:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">LogEvent</span><span style="color: black;"> : </span><span style="color: blue;">public</span><span style="color: black;"> </span><span style="color: #267f99;">AbstractObserver</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: blue;">public:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">explicit</span><span style="color: black;"> </span><span style="color: #795e26;">LogEvent</span><span style="color: black;">(</span><span style="color: blue;">const</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: blue;">&</span><span style="color: black;"> </span><span style="color: #001080;">name</span><span style="color: black;">) : </span><span style="color: #001080;">mName</span><span style="color: black;">(</span><span style="color: #001080;">name</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">OnNotify</span><span style="color: black;">() </span><span style="color: blue;">override</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">" log event did something"</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #795e26;">GetName</span><span style="color: black;">() </span><span style="color: blue;">const</span><span style="color: black;"> </span><span style="color: blue;">override</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: blue;">private:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #001080;">mName</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">AbstractObservable</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: blue;">public:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #795e26;">AbstractObservable</span><span style="color: black;">() {};</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: #795e26;">~AbstractObservable</span><span style="color: black;">() {}</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">AddObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;"> </span><span style="color: #001080;">eventMessage</span><span style="color: black;">,</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">></span><span style="color: blue;">&</span><span style="color: black;"> </span><span style="color: #001080;">observer</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">auto</span><span style="color: black;"> </span><span style="color: #001080;">it</span><span style="color: black;"> = </span><span style="color: #001080;">mObservers</span><span style="color: black;">.</span><span style="color: #795e26;">find</span><span style="color: black;">(</span><span style="color: #001080;">eventMessage</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">if</span><span style="color: black;">( </span><span style="color: #001080;">it</span><span style="color: #795e26;">==</span><span style="color: #001080;">mObservers</span><span style="color: black;">.</span><span style="color: #795e26;">end</span><span style="color: black;">() )</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">mObservers</span><span style="color: #795e26;">[</span><span style="color: #001080;">eventMessage</span><span style="color: #795e26;">]</span><span style="color: black;"> </span><span style="color: #795e26;">=</span><span style="color: black;"> </span><span style="color: #267f99;">ObserversList</span><span style="color: black;">();</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">mObservers</span><span style="color: #795e26;">[</span><span style="color: #001080;">eventMessage</span><span style="color: #795e26;">]</span><span style="color: black;">.</span><span style="color: #795e26;">push_front</span><span style="color: black;">(</span><span style="color: #001080;">observer</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">RemoveObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;"> </span><span style="color: #001080;">eventMessage</span><span style="color: black;">,</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">></span><span style="color: blue;">&</span><span style="color: black;"> </span><span style="color: #001080;">observer</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">auto</span><span style="color: black;"> </span><span style="color: #001080;">it</span><span style="color: black;"> = </span><span style="color: #001080;">mObservers</span><span style="color: black;">.</span><span style="color: #795e26;">find</span><span style="color: black;">(</span><span style="color: #001080;">eventMessage</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">if</span><span style="color: black;">(</span><span style="color: #001080;">it</span><span style="color: black;"> </span><span style="color: #795e26;">!=</span><span style="color: black;"> </span><span style="color: #001080;">mObservers</span><span style="color: black;">.</span><span style="color: #795e26;">end</span><span style="color: black;">())</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">ObserversList</span><span style="color: black;">& </span><span style="color: #001080;">observersList</span><span style="color: black;"> = </span><span style="color: #001080;">mObservers</span><span style="color: #795e26;">[</span><span style="color: #001080;">eventMessage</span><span style="color: #795e26;">]</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;">(</span><span style="color: #267f99;">ObserversList</span><span style="color: black;">::</span><span style="color: #267f99;">iterator</span><span style="color: black;"> </span><span style="color: #001080;">li</span><span style="color: black;"> = </span><span style="color: #001080;">observersList</span><span style="color: black;">.</span><span style="color: #795e26;">begin</span><span style="color: black;">();</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">li</span><span style="color: black;"> </span><span style="color: #795e26;">!=</span><span style="color: black;"> </span><span style="color: #001080;">observersList</span><span style="color: black;">.</span><span style="color: #795e26;">end</span><span style="color: black;">(); )</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">if</span><span style="color: black;">( (</span><span style="color: #795e26;">*</span><span style="color: #001080;">li</span><span style="color: black;">) </span><span style="color: #795e26;">==</span><span style="color: black;"> </span><span style="color: #001080;">observer</span><span style="color: black;"> )</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"Goodbye "</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #001080;">observer</span><span style="color: #795e26;">-></span><span style="color: #795e26;">GetName</span><span style="color: black;">() </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">observersList</span><span style="color: black;">.</span><span style="color: #795e26;">remove</span><span style="color: black;">(</span><span style="color: #001080;">observer</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">break</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">else</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #795e26;">++</span><span style="color: #001080;">li</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">NotifyAll</span><span style="color: black;">()</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;">(</span><span style="color: #267f99;">ObserversMap</span><span style="color: black;">::</span><span style="color: #267f99;">iterator</span><span style="color: black;"> </span><span style="color: #001080;">it</span><span style="color: black;"> = </span><span style="color: #001080;">mObservers</span><span style="color: black;">.</span><span style="color: #795e26;">begin</span><span style="color: black;">();</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">it</span><span style="color: #795e26;">!=</span><span style="color: #001080;">mObservers</span><span style="color: black;">.</span><span style="color: #795e26;">end</span><span style="color: black;">(); </span><span style="color: #795e26;">++</span><span style="color: #001080;">it</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;">(</span><span style="color: blue;">auto</span><span style="color: black;">& </span><span style="color: #001080;">o</span><span style="color: black;"> : </span><span style="color: #001080;">mObservers</span><span style="color: #795e26;">[</span><span style="color: #001080;">it</span><span style="color: #795e26;">-></span><span style="color: #001080;">first</span><span style="color: #795e26;">]</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">o</span><span style="color: #795e26;">-></span><span style="color: #795e26;">OnNotify</span><span style="color: black;">();</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">virtual</span><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">Notify</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;"> </span><span style="color: #001080;">message</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;">(</span><span style="color: blue;">auto</span><span style="color: black;">& </span><span style="color: #001080;">o</span><span style="color: black;">: </span><span style="color: #001080;">mObservers</span><span style="color: #795e26;">[</span><span style="color: #001080;">message</span><span style="color: #795e26;">]</span><span style="color: black;">)</span></span></div><div><span style="font-size: small;"><span style="color: black;"> {</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">o</span><span style="color: #795e26;">-></span><span style="color: #795e26;">OnNotify</span><span style="color: black;">();</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><div><span style="font-size: small;"><span style="color: black;"> }</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: blue;">private:</span></span></div><div><span style="font-size: small;"><span style="color: green;"> // Two typedefs here</span></span></div><div><span style="font-size: small;"><span style="color: green;"> // first for the forward_list of observers</span></span></div><div><span style="font-size: small;"><span style="color: green;"> // second for the unordered_map of EventMessageTypes map key</span></span></div><div><span style="font-size: small;"><span style="color: green;"> // and ObserversList map value</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">typedef</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">forward_list</span><span style="color: black;"><</span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">>> </span><span style="color: #267f99;">ObserversList</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: blue;">typedef</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">unordered_map</span><span style="color: black;"><</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">, </span><span style="color: #267f99;">ObserversList</span><span style="color: black;">> </span><span style="color: #267f99;">ObserversMap</span><span style="color: black;">;</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">ObserversMap</span><span style="color: black;"> </span><span style="color: #001080;">mObservers</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">ModelChildObservable</span><span style="color: black;"> : </span><span style="color: blue;">public</span><span style="color: black;"> </span><span style="color: #267f99;">AbstractObservable</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: blue;">public:</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;"> </span><span style="color: #001080;">eventMessage</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">};</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">()</span></span></div><div><span style="font-size: small;"><span style="color: black;">{</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">ModelChildObservable</span><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">;</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: x-small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">> </span><span style="color: #001080;">observable1a</span><span style="color: black;"> = </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">make_shared</span><span style="color: black;"><</span><span style="color: #267f99;">SoundEvent</span><span style="color: black;">>(</span><span style="color: #a31515;">"observable1a"</span><span style="color: black;">);</span></span></div><div><span style="font-size: x-small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">> </span><span style="color: #001080;">observable1b</span><span style="color: black;"> = </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">make_shared</span><span style="color: black;"><</span><span style="color: #267f99;">SoundEvent</span><span style="color: black;">>(</span><span style="color: #a31515;">"observable1b"</span><span style="color: black;">);</span></span></div><div><span style="font-size: x-small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">> </span><span style="color: #001080;">observable2</span><span style="color: black;"> = </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">make_shared</span><span style="color: black;"><</span><span style="color: #267f99;">PhysicsEvent</span><span style="color: black;">>(</span><span style="color: #a31515;">"observable2"</span><span style="color: black;">);</span></span></div><div><span style="font-size: x-small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">shared_ptr</span><span style="color: black;"><</span><span style="color: #267f99;">AbstractObserver</span><span style="color: black;">> </span><span style="color: #001080;">observable3</span><span style="color: black;"> = </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">make_shared</span><span style="color: black;"><</span><span style="color: #267f99;">LogEvent</span><span style="color: black;">>(</span><span style="color: #a31515;">"observable3"</span><span style="color: black;">);</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">AddObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">PLAYSOUND</span><span style="color: black;">, </span><span style="color: #001080;">observable1a</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">AddObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">PLAYSOUND</span><span style="color: black;">, </span><span style="color: #001080;">observable1b</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">AddObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">HANDLEPHYSICS</span><span style="color: black;">, </span><span style="color: #001080;">observable2</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">AddObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">LOG</span><span style="color: black;">, </span><span style="color: #001080;">observable3</span><span style="color: black;">);</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">NotifyAll</span><span style="color: black;">();</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">Notify</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">PLAYSOUND</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">RemoveObserver</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">PLAYSOUND</span><span style="color: black;">, </span><span style="color: #001080;">observable1a</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #001080;">modelChildObservable</span><span style="color: black;">.</span><span style="color: #795e26;">Notify</span><span style="color: black;">(</span><span style="color: #267f99;">EventMessageTypes</span><span style="color: black;">::</span><span style="color: #0070c1;">PLAYSOUND</span><span style="color: black;">);</span></span></div><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></span></div><span style="font-size: small;"><br /></span><div><span style="font-size: small;"><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #098658;">0</span><span style="color: black;">;</span></span></div><div><span style="font-size: small;"><span style="color: black;">}</span></span></div></div><p>Program output:<br />observable3 log event did something<br />observable1b sound event did something<br />observable1a sound event did something<br />observable2 physics event did something<br /><br />observable1b sound event did something<br />observable1a sound event did something<br /><br />Goodbye observable1a<br /><br />observable1b sound event did something</p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-12965575062038490902023-03-02T22:05:00.008+08:002023-03-02T22:07:26.810+08:00C++ time in seconds, minutes, hours by include chrono and using namespace std::chrono<div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;">Program:<br /><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></div><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><chrono></span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">;</span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">::</span><span style="color: #267f99;">chrono</span><span style="color: black;">;</span></div><br /><div><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">()</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: blue;">auto</span><span style="color: black;"> dura_sec = </span><span style="color: #098658;">5s</span><span style="color: black;">;</span></div><div><span style="color: black;"> </span><span style="color: blue;">auto</span><span style="color: black;"> dura_min = </span><span style="color: #098658;">3min</span><span style="color: black;">;</span></div><div><span style="color: black;"> </span><span style="color: blue;">auto</span><span style="color: black;"> dura_hour = </span><span style="color: #098658;">2h</span><span style="color: black;">;</span></div><br /><div><span style="color: black;"> duration<</span><span style="color: blue;">double</span><span style="color: black;">, ratio<</span><span style="color: #098658;">1</span><span style="color: black;">>> to_dura_sec = dura_min;</span></div><div><span style="color: black;"> cout << </span><span style="color: #001080;">dura_min</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"min </span><span style="color: #ee0000;">\t</span><span style="color: #a31515;">= "</span><span style="color: black;"> <br /> << </span><span style="color: #001080;">to_dura_sec</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"s"</span><span style="color: black;"> << endl;</span></div><br /><div><span style="color: black;"> to_dura_sec = dura_hour;</span></div><div><span style="color: black;"> cout << </span><span style="color: #001080;">dura_hour</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"h </span><span style="color: #ee0000;">\t</span><span style="color: #a31515;">= "</span><span style="color: black;"> <br /> << </span><span style="color: #001080;">to_dura_sec</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"s"</span><span style="color: black;"> << endl;</span></div><br /><div><span style="color: black;"> </span><span style="color: blue;">auto</span><span style="color: black;"> dura_time = dura_sec + dura_min + dura_hour;</span></div><div><span style="color: black;"> cout << </span><span style="color: #001080;">dura_sec</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"s + "</span><span style="color: black;">;</span></div><div><span style="color: black;"> cout << </span><span style="color: #001080;">dura_min</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"min + "</span><span style="color: black;">;</span></div><div><span style="color: black;"> cout << </span><span style="color: #001080;">dura_hour</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"h = "</span><span style="color: black;">;</span></div><div><span style="color: black;"> cout << </span><span style="color: #001080;">dura_time</span><span style="color: black;">.</span><span style="color: #795e26;">count</span><span style="color: black;">() << </span><span style="color: #a31515;">"s"</span><span style="color: black;"> << endl;</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> EXIT_SUCCESS;</span></div><div><span style="color: black;">}<br /><br />Sample output:</span></div><div><span style="color: black;"></span>$ g++ -std=c++20 cpp2020_chrono_time.cpp <br />$ ./a.out<br />3min = 180s<br />2h = 7200s<br />5s + 3min + 2h = 7385s </div></div><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-61291063406412314182023-03-01T16:10:00.034+08:002023-03-06T21:25:42.045+08:00Land pollution, Air pollution, Water pollutionJust for a little and short term and unsustainable profit with no regard to living lives.<br />I mean, I know what I'm dealing with.<br />I'm not drinking the water.<br />I'm not eating the food. <br />I don't trust it at all.<br />This is our place and community.<br />Like, I know every road around here.<br />We can't just uproot and go and give up. No to I don’t care attitude.<br />Obviously, something that catastrophic to that extent has to do more to the environment and everything than what the commercial company is saying.<br />But you do have to wonder when you go and smell that, and of course, you're gonna smell any effects when the pollutants have mess with anything at the site without preventative measures in their minds, and you can also taste the chemical in your mouth, almost like a smell taste.<br />Put forth a big effort into making sure that the world governments constantly monitoring environment and natural resources, but I'm also now starting to kind of be a little more concerned of the lasting impacts after the entirely preventable disaster or chemical spilled.<br /><br />When the chemical big flame and smoke look like this and makes the air smell strange for days.<br />It doesn't take an expert to know people will be scared that they'll worry if it can kill thousands of fish what can it do to them.<br /><br />Though is far from back to normal, and the messages that were meant to reassure for many, have had the opposite effect. We're not getting any truth. I'm not safe being here. There is no way we are safe being here. You just have to assume everyone's lying to you. There are a lot of elements to this event that have kind of created a perfect storm for disinformation and conspiracy theories.<br /><br />Fears they'd explode the shortness of breath and headaches and skin rashes can be caused by some of those chemicals. These are chemicals especially the vinyl chloride that we have long known are extremely toxic to humans. <br /><br />Some are skeptical about the answers provided publicly but prefers evidence.<br /><br />The haram beef meat religion laws of the country to help the economy to export and to reduce imported foods.<br />Without vegetarians, the country food economy will collapse from scarcity of animal meats. <br />The country depends on food imports where more than 50% of foods are imported. <br /><br />No credibility whatsoever coronavirus 1, coronavirus 2, and coronavirus 3 are created in the noisy praying place. <br />The virus was the result of natural transmission in the crowded praying places.<br />We denounced religion terrorist Donald Trash comments, saying it was firmly opposed to any form of "political manipulation" of the facts.<br />Based on the poor track record of fraud and deception of the Donald Trash community, the conclusions they draw have no credibility whatsoever.<br />We urge the the religion terrorist Donald Trash side to respect science and facts.<br /><br />This pollution was a case of when you will die young and not if you will die young. <div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-853435937627111422023-02-01T22:58:00.003+08:002023-02-01T22:58:18.766+08:00Microsoft LinkedIn Learning website: turn off all the email notifications<p>Steps:<br />- Browse to Microsoft LinkedIn Learning website <br /><br />- top menu > Me > Settings <br /><br />- Under Notification settings > Email, received via your primary email > click the right arrow <br /><br />- Toggle off all the email notifications: reminders, welcome to LinkedIn Learning Series, Recommendations</p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-23828031957521714852023-01-08T06:53:00.010+08:002023-01-08T07:04:04.525+08:00Solutions to C++ error: passing 'const std::map std::__cxx11::basic_string char, std::__cxx11::basic_string char ' as 'this' argument discards qualifiers [-fpermissive]What is the error of the following program?<br /><br /><div id="docs-internal-guid-7e07426d-7fff-3ee5-e233-ac6f2539079b" style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: #af00db; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">#include</span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><iostream></span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: #af00db; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">#include</span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><map></span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: #af00db; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">using</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">namespace</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">std</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">void</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">mapCout</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">(</span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">const</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">map</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">string</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">,</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> string</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">></span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">&</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">)</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">{</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #af00db; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">for</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">(</span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">auto</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">pair</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> : </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">)</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> {</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">cout</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><<</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"m[</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #ee0000; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">\"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><<</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">pair</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">.</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">first</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><<</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #ee0000; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">\"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">] = "</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> << </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">[</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">pair</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">.</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">first</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">] << </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">endl</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-size: x-small;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: green; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> //solutions</span></span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-size: x-small;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: green; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> //cout << "m[\"" << pair.first << "\"] = " << pair.second << endl;</span></span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-size: x-small;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: green; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> //cout << "m[\"" << pair.first << "\"] = " << m.at(pair.first) << endl;</span></span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> }</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">}</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">int</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">main</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">(</span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">int</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">argc</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">, </span><span face="Consolas,sans-serif" style="background-color: transparent; color: blue; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">char*</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">argv</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">[])</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">{</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">map</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">string</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">,</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">string</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">string</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">key1</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> = </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"aa"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #267f99; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">string</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">value1</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> = </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"apple"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">[</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">key1</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">]</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">=</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">value1</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">[</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"bb"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">]</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">=</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"banana"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">[</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"cc"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">]</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">=</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #a31515; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">"cucumber"</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #795e26; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">mapCout</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">(</span><span face="Consolas,sans-serif" style="background-color: transparent; color: #001080; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">m</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">);</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"> </span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #af00db; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">return</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"> </span><span face="Consolas,sans-serif" style="background-color: transparent; color: #098658; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">0</span><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">;</span></span></div><div style="background-color: white; line-height: 1.62857; margin-bottom: 0pt; margin-top: 0pt; text-align: left;"><span style="font-family: courier;"><span face="Consolas,sans-serif" style="background-color: transparent; color: black; font-size: 10.5pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">}</span></span></div><br />Solutions:<br />take note in function 'void mapCout(const std::map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)'<br /><br />error: passing 'const std::map<std::__cxx11::basic_string<char>,<br />std::__cxx11::basic_string<char> >' as<br />'this' argument discards qualifiers [-fpermissive]<br /><br />Read The F*** Manual (Fine), read by yourself a fine C++ manual<br />Both the map::operator[] function declarations return a reference and non-constant to its mapped value:<br />mapped_type& operator[] (const key_type& k);<br />mapped_type& operator[] (key_type&& k);<br /><br />Solution:<br />see at the function constant parameter "const map<string,string>& m"<br />map operator[] is non-constant because<br />it inserts the key if it does not exist<br />and returns a reference to its mapped value<br />if you want the map container to be constant,<br />the member function at() may be used<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-68360616280094808492022-12-26T18:50:00.001+08:002022-12-26T18:50:09.152+08:00Solutions to C++ error: request for member 'variableName' in '(LinkedList*)this', which is of pointer type 'LinkedList*' (maybe you meant to use '->' ?)<p>What is the error of the following program?</p><div style="background-color: white; color: black; font-family: Consolas, 'Courier New', monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">;</span></div><br /><div><span style="color: blue;">template</span><span style="color: black;"> <</span><span style="color: blue;">typename</span><span style="color: black;"> </span><span style="color: #267f99;">T</span><span style="color: black;">></span></div><div><span style="color: blue;">class</span><span style="color: black;"> </span><span style="color: #267f99;">LinkedList</span></div><div><span style="color: black;">{</span></div><div><span style="color: blue;">private:</span></div><div><span style="color: black;"> </span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #001080;">variableName</span><span style="color: black;"> = </span><span style="color: #a31515;">""</span><span style="color: black;">;</span></div><div><span style="color: blue;">public:</span></div><div><span style="color: black;"> </span><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">setVariableName</span><span style="color: black;">(</span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #001080;">variableName</span><span style="color: black;">)</span></div><div><span style="color: black;"> {</span></div><div><span style="color: black;"> </span><span style="color: blue;">this</span><span style="color: black;">.</span><span style="color: #001080;">variableName</span><span style="color: black;"> = </span><span style="color: #001080;">variableName</span><span style="color: black;">;</span></div><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"You cannot let the </span><span style="color: #ee0000;">\"</span><span style="color: #a31515;">this</span><span style="color: #ee0000;">\"</span><span style="color: #a31515;"> pointer "</span></div><div><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"to use the dot operator </span><span style="color: #ee0000;">\"</span><span style="color: #a31515;">.</span><span style="color: #ee0000;">\"</span><span style="color: #a31515;">, "</span></div><div><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"change to the right arrow operator instead"</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></div><div><span style="color: black;"> }</span></div><div><span style="color: black;">};</span><span style="color: green;"> // put semicolon or else error: expected ';' after class definition</span></div><br /><div><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">(</span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">argc</span><span style="color: black;">, </span><span style="color: blue;">char*</span><span style="color: black;"> </span><span style="color: #001080;">argv</span><span style="color: black;">[])</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: #267f99;">LinkedList</span><span style="color: black;"><</span><span style="color: blue;">int</span><span style="color: black;">> </span><span style="color: #001080;">linkedList</span><span style="color: black;">;</span></div><br /><div><span style="color: black;"> </span><span style="color: #001080;">linkedList</span><span style="color: black;">.</span><span style="color: #795e26;">setVariableName</span><span style="color: black;">(</span><span style="color: #a31515;">"variableName"</span><span style="color: black;">);</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #098658;">0</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div></div><p>Solutions:<br />take note that the dot operator or "." cannot be used for<br />the "this" pointer<br /><br />warning: In instantiation of 'void LinkedList<T>::setVariableName(std::__cxx11::string)<br />[with T = int; std::__cxx11::string = std::__cxx11::basic_string<char>]':<br />warning continued: required from here<br />error: request for member 'variableName' in '(LinkedList<int>*)this',<br />which is of pointer type 'LinkedList<int>*' (maybe you meant to use '->' ?)<br /><br />error: request for member 'variableName' in '(LinkedList<int>*)this',<br />which is of pointer type 'LinkedList<int>*' (maybe you meant to use '->' ?)<br />Solution:<br />dot operator error at the "this" pointer<br />you cannot use the dot operator or "." for the "this" pointer,<br />change to the right arrow operator or -></p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-334165218726987722022-12-26T16:38:00.008+08:002022-12-26T18:45:20.921+08:00Solutions to C++ error: note: cannot convert '1' (type 'int') to type 'int&'<p>What is the error of the following program?<br /></p><div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">;</span></div><br /><div><span style="color: blue;">template</span><span style="color: black;"> <</span><span style="color: blue;">typename</span><span style="color: black;"> </span><span style="color: #267f99;">T</span><span style="color: black;">></span></div><div><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #795e26;">insert</span><span style="color: black;">(</span><span style="color: #267f99;">T</span><span style="color: blue;">&</span><span style="color: black;"> </span><span style="color: #001080;">item</span><span style="color: black;">)</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"You cannot have the symbol </span><span style="color: #ee0000;">\"</span><span style="color: #a31515;">ampersand</span><span style="color: #ee0000;">\"</span><span style="color: #a31515;"> "</span></div><div><span style="color: #795e26;"> <<</span><span style="color: black;"> </span><span style="color: #a31515;">"as the function parameter passed by value "<br /> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"</span><span style="color: #a31515;">to receive the integer number, "</span></div><div><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"remove the symbol ampersand instead"</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div><br /><div><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">(</span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">argc</span><span style="color: black;">, </span><span style="color: blue;">char*</span><span style="color: black;"> </span><span style="color: #001080;">argv</span><span style="color: black;">[])</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">integer</span><span style="color: black;"> = </span><span style="color: #098658;">1</span><span style="color: black;">;</span></div><br /><div><span style="color: black;"> </span><span style="color: #795e26;">insert</span><span style="color: black;"><</span><span style="color: blue;">int</span><span style="color: black;">>(</span><span style="color: #098658;">1</span><span style="color: black;">);</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #098658;">0</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div></div><p>Solutions:<br />take note that the symbol "ampersand" or "&" cannot be used as<br />the function parameter passed by value to receive the integer number,<br />the actual function caller argument, from the main() function body<br /><br />error: no matching function for call to 'add<int>(int)'<br />note 1: candidate: 'template<class T> void add(T&)'<br />note 2: template argument deduction/substitution failed<br />note 3: cannot convert '1' (type 'int') to type 'int&'<br /><br />error: note: cannot convert '1' (type 'int') to type 'int&'<br />Solution:<br />ampersand or & error at the function parameter<br />you cannot have the symbol "ampersand" or "&" as the function parameter passed by value,<br />remove the symbol ampersand or & </p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-25233812028722698182022-12-25T07:51:00.008+08:002022-12-26T18:45:39.468+08:00Solutions to C++ error: expected unqualified-id before 'delete' and C++ error: expected primary-expression before ')' token<p>What are the two errors of the following program?</p><div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">;</span></div><br /><div><span style="color: blue;">void</span><span style="color: black;"> </span><span style="color: #af00db;">delete</span><span style="color: black;">()</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"You cannot have the word </span><span style="color: #ee0000;">\"</span><span style="color: #a31515;">delete</span><span style="color: #ee0000;">\"</span><span style="color: #a31515;"> "</span></div><div><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"as the function name or variable name, "</span></div><div><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"choose other name instead"</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div><br /><div><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">(</span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">argc</span><span style="color: black;">, </span><span style="color: blue;">char*</span><span style="color: black;"> </span><span style="color: #001080;">argv</span><span style="color: black;">[])</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: #af00db;">delete</span><span style="color: black;">();</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #098658;">0</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div></div><p>Solutions:<br />take note that the keyword "delete" cannot be used as the function name or variable name<br /><br />Error 1: expected unqualified-id before 'delete'<br />Solution:<br />function name error at the function header<br />you cannot have the word "delete" as the function name, variable name<br />use different function name such as deleteNode<br /><br />Error 2: expected primary-expression before ')' token<br />Solution:<br />function caller name error in the main function body<br />you cannot have the word "delete" as the function caller name, function name, variable name<br />use different function name such as deleteNode<br /></p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-77332013787317325512022-12-22T08:38:00.004+08:002022-12-22T08:38:28.841+08:00Six best things in life are priceless and you cannot buy them Many things to do with the happiness are totally uncorrelated if you reach above a certain level of income, as long as you have food, shelter and basic needs of life. <br /><br />Having more income and wealth doesn't necessarily make you happy. <br /><br />Do you live a simple life or a wealthy life?<br /><br />I live a life in which I have a home, I don't have a car, I don't even have a bicycle, I use public transportation in the city to go around.<br />I don't have a boat, I don't have a plane, you know I don't buy fancy stuffs.<br /><br />I ponder if you know that the best things in life are Priceless. <br />You cannot buy: <br />1 friendship, <br />2 love, <br />3 happiness, <br />4 community, <br />5 compassion, <br />6 care <br /><br />We have to maybe change our values and realize that maybe giving to others makes us more happy than having more material things for ourselves.<br /><br />If you accept that maybe we'll accept even no economic growth and we can deal with.<br /><br />There is so much pollution created by waste and each of us individually should do sacrifices to reduce our carbon footprint if we don't we're doomed.<div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-4103360054437611812022-11-14T21:34:00.013+08:002022-11-14T21:49:49.258+08:00Three factors on how to win over the Donald Trash pathological liar<p>Top three motivating factors to win over the Donald Trash pathological liar<br /><br />1 Legalize woman abortion rights <br />Conservatives favor legal woman abortion rights<br />Conservatives fear extremism of their own political party and the extremist Donald Trash<br /><br />2 Focus on domestic agenda, focus on people’s bread and butter issues <br />Push many popular provisions and legislation such as <br />* passed the inflation reduction act, <br />* lowered prescription drug costs significantly, <br />* invested in clean energy, <br />* passed the People Rescue Plan which gave people checks and extended all kinds of reliefs, <br />* hired more teachers, <br />* passed the technology chip act, <br />* invested in high-tech domestic manufacturing through executive action, <br />* relieved people of their student loan debt forgiveness from $20K to as much as $40K, <br />* passed the historic bipartisan infrastructure bill, <br />* put a minority race person on the supreme court, <br />* pushed many healthcare and education socialism acts,<br />* defended against challengers, have strong messages to run on the election <br /><br />3 Be strong, spirited and consistent defense of democracy and against extremist anti-democratic Donald Trash <br />Rejection that it is a stolen general election on 6 January 2020 in the big lie by the extremist Donald Trash,<br />you have the power, <br />it's your choice, <br />it's your decision, <br />each and every one of us to preserve our democracy, <br />it always lies with the people, <br />protect the threatened democracy and security, <br />against extremist anti-democratic Donald Trash, <br />support democracy around the world, <br />yes actually patriotic people do actually care about democracy, <br />pro-democracy voters, <br />stand up to Republican extremism and Donald Trash extremism</p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-75292145283178613582022-11-10T23:54:00.008+08:002022-11-10T23:54:53.055+08:00C++ Syntax error: no match for 'operator=' (operand types are 'std::__cxx11::string' {aka 'std::__cxx11::basic_string'} and '') (solved)<p>Program:<br /></p><div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">;</span></div><br /><div><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">()</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: #795e26;">srand</span><span style="color: black;">(</span><span style="color: #098658;">123</span><span style="color: black;">);</span></div><br /><div><span style="color: black;"> </span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">vertices</span><span style="color: black;"> = </span><span style="color: #098658;">10</span><span style="color: black;">;</span></div><br /><div><span style="color: black;"> </span><span style="color: #267f99;">string</span><span style="color: black;"> </span><span style="color: #001080;">A</span><span style="color: black;">[</span><span style="color: #001080;">vertices</span><span style="color: black;">][</span><span style="color: #001080;">vertices</span><span style="color: black;">];</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;"> ( </span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">i</span><span style="color: black;"> = </span><span style="color: #098658;">0</span><span style="color: black;">; </span><span style="color: #001080;">i</span><span style="color: black;"> < </span><span style="color: #001080;">vertices</span><span style="color: black;">; ++</span><span style="color: #001080;">i</span><span style="color: black;"> )</span></div><div><span style="color: black;"> {</span></div><div><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;"> ( </span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">j</span><span style="color: black;"> = </span><span style="color: #098658;">0</span><span style="color: black;">; </span><span style="color: #001080;">j</span><span style="color: black;"> < </span><span style="color: #001080;">vertices</span><span style="color: black;">; ++</span><span style="color: #001080;">j</span><span style="color: black;"> )</span></div><div><span style="color: black;"> {</span></div><div><span style="color: black;"> </span><span style="color: #001080;">A</span><span style="color: black;">[</span><span style="color: #001080;">i</span><span style="color: black;">][</span><span style="color: #001080;">j</span><span style="color: black;">] = to_string{ </span><span style="color: #795e26;">rand</span><span style="color: black;">()%</span><span style="color: #098658;">100</span><span style="color: black;">+</span><span style="color: #098658;">1</span><span style="color: black;"> };</span></div><div><span style="color: black;"> }</span></div><div><span style="color: black;"> }</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #098658;">0</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div></div><p></p><p>Solution: Change braces { .. } to parentheses ( .. )<br /></p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-45523639511186473542022-11-06T01:05:00.001+08:002022-11-06T01:05:15.286+08:00C++ main function arguments, program that knows what you type on the terminal window<p>Program:</p><div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-size: 14px; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="color: #af00db;">#include</span><span style="color: blue;"> </span><span style="color: #a31515;"><iostream></span></div><div><span style="color: #af00db;">using</span><span style="color: black;"> </span><span style="color: blue;">namespace</span><span style="color: black;"> </span><span style="color: #267f99;">std</span><span style="color: black;">;</span></div><br /><div><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #795e26;">main</span><span style="color: black;">(</span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">argc</span><span style="color: black;">, </span><span style="color: blue;">char*</span><span style="color: black;"> </span><span style="color: #001080;">argv</span><span style="color: black;">[])</span></div><div><span style="color: black;">{</span></div><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"Number of arguments: "</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #001080;">argc</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #795e26;">endl</span><span style="color: black;">; </span></div><br /><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">"You type: "</span><span style="color: black;">; </span></div><div><span style="color: black;"> </span><span style="color: #af00db;">for</span><span style="color: black;"> (</span><span style="color: blue;">int</span><span style="color: black;"> </span><span style="color: #001080;">c</span><span style="color: black;">=</span><span style="color: #098658;">0</span><span style="color: black;">; </span><span style="color: #001080;">c</span><span style="color: black;"><</span><span style="color: #001080;">argc</span><span style="color: black;">; </span><span style="color: #001080;">c</span><span style="color: black;">++)</span></div><div><span style="color: black;"> {</span></div><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #001080;">argv</span><span style="color: black;">[</span><span style="color: #001080;">c</span><span style="color: black;">] </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #a31515;">" "</span><span style="color: black;">;</span></div><div><span style="color: black;"> }</span></div><div><span style="color: black;"> </span><span style="color: #001080;">cout</span><span style="color: black;"> </span><span style="color: #795e26;"><<</span><span style="color: black;"> </span><span style="color: #795e26;">endl</span><span style="color: black;">;</span></div><br /><div><span style="color: black;"> </span><span style="color: #af00db;">return</span><span style="color: black;"> </span><span style="color: #098658;">0</span><span style="color: black;">;</span></div><div><span style="color: black;">}</span></div></div><p>Sample run:<br />> g++ a.cpp<br />> a.exe word2 word3 word4 <br />Number of arguments: 4<br />You type: a.exe word2 word3 word4</p><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-33531396514697722972022-11-01T03:20:00.009+08:002022-11-01T03:27:20.987+08:00Logic error and output error: array size problem<div style="background-color: white; color: black; font-family: Consolas, "Courier New", monospace; font-weight: normal; line-height: 19px; white-space: pre;"><div style="background-color: white; font-weight: normal; line-height: 19px; white-space: pre;"><div><span style="font-size: small;"><span style="font-family: courier;">Question: Why and how to get the correct output </span></span></div><div><span style="font-size: small;"><span style="font-family: courier;">which is "Sum: 5" after you have entered 1 five times?<br /><br />#include <iostream><br />using namespace std;<br /><br />int main()<br />{<br /> int mysize = 5;<br /> int myarray[4];<br /><br /> cout << "Enter five numbers and calculate sum" << endl;<br /> for (int i=0; i<mysize; ++i)<br /> {<br /> cout << "Enter number " << i+1 << " => ";<br /> cin >> myarray[i]; // to enter 1 five times<br /> }<br /><br /> int sum = 0;<br /> for (int i=0; i<mysize; ++i)<br /> {<br /> sum += myarray[i];<br /> }<br /> cout << "Sum: " << sum << endl; // sum 1 is wrong<br /><br /> return 0;<br />}</span></span></div></div></div><div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-7058339.post-39736322102241038792022-11-01T00:50:00.002+08:002022-11-01T00:50:14.827+08:00Joke: Yeah, kids kill someone before Adult: Have you ever actually killed anyone?<br />Kid: Yeah.<br />Adult: Where?<br />Kid: In a video game, Grand Theft Auto. <div class="blogger-post-footer">by: yt [at] internet</div>Unknownnoreply@blogger.com0