<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>C++ Tutorial - Strings</title><link>/technologies/code_exchange/b/blog/posts/c-tutorial---strings</link><description>IntroductionIn the previous tutorial , we talked about reading and writing binary data to a file. In this tutorial, we are going to talk about strings. Strings are a way of storing and manipulating text within C++.CodeLet’s jump right in an...</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: C++ Tutorial - Strings</title><link>https://community.element14.com/technologies/code_exchange/b/blog/posts/c-tutorial---strings</link><pubDate>Thu, 07 May 2015 03:09:04 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:8de09023-65be-4576-9d71-5edef55f4c2a</guid><dc:creator>Former Member</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Interesting lesson. A couple of observations:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;1) I noticed that the line:&lt;/p&gt;&lt;p&gt;&lt;span&gt;string&lt;/span&gt;&lt;span&gt; cat = foo.append(bar);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;also appends bar to foo, such that both cat and foo become foobar&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;2) In your sentence game, I kept getting &amp;quot;The man in the white hat loves a Raspberry Pi.&amp;quot; over and over again. Fortunately, I remembered your lesson 3 and brought in&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span&gt;#include &amp;lt;ctime&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;and then added the line&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;srand((&lt;span&gt;unsigned int&lt;/span&gt;) time(NULL));&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;to your why() function right before&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt; chance = rand() % 10;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span&gt;then I got a variety of results.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="https://community.element14.com/aggbug?PostID=15778&amp;AppID=74&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>