{"appState":{"pageLoadApiCallsStatus":true},"categoryState":{"relatedCategories":{"headers":{"timestamp":"2025-04-17T16:01:06+00:00"},"categoryId":33597,"data":{"title":"C++","slug":"cplusplus","image":{"src":null,"width":0,"height":0},"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"parentCategory":{"categoryId":33592,"title":"Programming & Web Design","slug":"programming-web-design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"}},"childCategories":[],"description":"C++ is a flexible and powerful programming language. Learn the basics, plus some cool tidbits you haven't seen before.","relatedArticles":{"self":"https://dummies-api.dummies.com/v2/articles?category=33597&offset=0&size=5"},"hasArticle":true,"hasBook":true,"articleCount":63,"bookCount":3},"_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"relatedCategoriesLoadedStatus":"success"},"listState":{"list":{"count":10,"total":63,"items":[{"headers":{"creationTime":"2016-03-27T16:58:47+00:00","modifiedTime":"2021-03-19T20:55:32+00:00","timestamp":"2022-09-14T18:17:58+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"C++ All-in-One For Dummies Cheat Sheet","strippedTitle":"c++ all-in-one for dummies cheat sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","canonicalUrl":"","seo":{"metaDescription":"You can program in C++ in more than one way. Explore the common programming paradigms and 10 common C++ mistakes.","noIndex":0,"noFollow":0},"content":"C++ continues to get better over the years because people just keep contributing to it and finding new ways to work with it. You can find C++ in an amazing array of applications because it works everywhere — from desktop and mobile applications to embedded applications and other types of systems.\r\n\r\nBecause C++ is so incredibly flexible, people keep coming to it as a best solution for many general programming needs and some specific needs as well.\r\n\r\n[caption id=\"attachment_275559\" align=\"alignnone\" width=\"556\"]<img class=\"size-full wp-image-275559\" src=\"https://www.dummies.com/wp-content/uploads/c-concept.jpg\" alt=\"C++ programming\" width=\"556\" height=\"380\" /> © andriano.cz / Shutterstock.com[/caption]","description":"C++ continues to get better over the years because people just keep contributing to it and finding new ways to work with it. You can find C++ in an amazing array of applications because it works everywhere — from desktop and mobile applications to embedded applications and other types of systems.\r\n\r\nBecause C++ is so incredibly flexible, people keep coming to it as a best solution for many general programming needs and some specific needs as well.\r\n\r\n[caption id=\"attachment_275559\" align=\"alignnone\" width=\"556\"]<img class=\"size-full wp-image-275559\" src=\"https://www.dummies.com/wp-content/uploads/c-concept.jpg\" alt=\"C++ programming\" width=\"556\" height=\"380\" /> © andriano.cz / Shutterstock.com[/caption]","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":196545,"title":"C++ Syntax that You May Have Forgotten","slug":"c-syntax-that-you-may-have-forgotten","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196545"}},{"articleId":196544,"title":"The Usual C++ Header Files","slug":"the-usual-c-header-files","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196544"}}],"fromCategory":[{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}},{"articleId":200134,"title":"Expressing Binary Numbers in C++","slug":"expressing-binary-numbers-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/200134"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221ad6d28a2\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221ad6d31cf\"></div></div>"},"articleType":{"articleType":"Cheat Sheet","articleList":[{"articleId":196543,"title":"The 10 Most Common C++ Mistakes","slug":"the-10-most-common-c-mistakes","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196543"}}],"content":[{"title":"C++ Programming Paradigms","thumb":null,"image":null,"content":"<p>You can program in C++ in more than one way. Most people think you’re limited to using just procedural or object-oriented programming techniques. However, if you stop there, you’re missing out on half the fun of working with C++. The following list describes the various C++ programming paradigms in common use today:</p>\n<ul>\n<li><strong>Imperative:</strong> Imperative programming takes a step-by-step approach to performing a task. The developer provides commands that describe precisely how to perform the task from beginning to end. During the process of executing the commands, the code also modifies application state, which includes the application data. The code runs from beginning to end. An imperative application closely mimics the computer hardware, which executes machine code. Machine code is the lowest set of instructions that you can create and is mimicked in early languages, such as assembler.</li>\n<li><strong>Procedural:</strong> Procedural programming implements imperative programming, but adds functionality such as code blocks and procedures for breaking up the code. The compiler or interpreter still ends up producing machine code that runs step by step, but the use of procedures makes it easier for a developer to follow the code and understand how it works. Many procedural languages provide a disassembly mode in which you can see the correspondence between the higher-level language and the underlying assembler.</li>\n<li><strong>Object-oriented:</strong> The procedural paradigm does make reading code easier. However, the relationship between the code and the underlying hardware still makes it hard to relate what the code is doing to the real world. The object-oriented paradigm uses the concept of objects to hide the code, but more important, to make modeling the real world easier. A developer creates code objects that mimic the real-world objects they emulate. These objects include properties, methods, and events to allow the object to behave in a particular manner.</li>\n<li><strong>Functional:</strong> Functional programming has somewhat different goals and approaches than other paradigms use. Goals define what the functional programming paradigm is trying to do in forging the approaches used by languages that support it. However, the goals don’t specify a particular implementation; doing that is within the purview of the individual languages. The main difference between the functional programming paradigm and other paradigms is that functional programs use math functions rather than statements to express ideas. This difference means that rather than write a precise set of steps to solve a problem, you use math functions, and you don’t worry about how the language performs the task.</li>\n<li><strong>Declarative:</strong> Functional programming actually implements the declarative programming paradigm, but the two paradigms are separate. Other paradigms, such as logic programming, implemented by the Prolog language, also support the declarative programming paradigm. The short view of declarative programming is that it does the following: describes what the code should do, rather than how to do it; defines functions that are referentially transparent (without side effects); and provides a clear correspondence to mathematical logic.</li>\n</ul>\n"},{"title":"10 Common C++ Mistakes","thumb":null,"image":null,"content":"<p>It’s possible to make mistakes in coding, even if you’re not aware of them. A lack of knowledge about a new programming requirement is still a mistake, but one that you might have a very hard time finding. Although many C++ programmers take measures to prevent bugs, mistakes still slip through. This list of ten common mistakes while writing C++ code can help both new and veteran programmers:</p>\n<ul>\n<li>Failure to declare the variable</li>\n<li>Using the wrong uppercase and lowercase letters; for example, you typed Main when you meant main</li>\n<li>Employing one equals sign (<code>=</code>) when you were supposed to use two (<code>==</code>), either in an if statement or in a for</li>\n<li>Leaving out <code>#include &lt;iostream&gt;</code> or using <code>namespace std;</code></li>\n<li>Relying on older programming techniques, language features, or library calls after upgrading to a newer version of C++</li>\n<li>Forgetting to call <code>new </code>and using the pointer anyway</li>\n<li>Omitting the word <code>public:</code> in your classes, so everything turned up private</li>\n<li>Creating ambiguous references to classes when working with multiple libraries so that your code ends up using the wrong library</li>\n<li>Leaving off the parentheses when calling a function that takes no parameters</li>\n<li>Skipping a semicolon, probably at the end of a class declaration, or other necessary punctuation</li>\n</ul>\n"},{"title":"Overview of the Standard Library Categories","thumb":null,"image":null,"content":"<p>The Standard Library is immense and becoming larger all the time. No one can possibly master such a large coding option, yet developers still have to find their way around it. The best way to begin is to break the Standard Library into smaller pieces. You can categorize the <a href=\"https://dummies-wp-admin.dummies.com/programming/cpp/the-udls-included-in-the-c-standard-library/\">Standard Library</a> functions in a number of ways. One of the most common approaches is to use the following categories:</p>\n<ul>\n<li><strong>Algorithms:</strong> Performs data manipulations such as replacing, locating, or sorting information</li>\n<li><strong>Atomic Operations (C++ 11 and above):</strong> Allows construction of a code block that executes as a single concurrent entity without the use of locking mechanisms</li>\n<li><strong>C Compatibility:</strong> Provides you with access to functionality that came with the original C language</li>\n<li><strong>Concepts (C++ 20 and above):</strong> Provides predicates that express a generic algorithm’s expectations through concepts; You use a concept to formally document the constraints on a template to enforce certain behaviors.</li>\n<li><strong>Containers:</strong> Allows storage of various kinds of data using a specific approach; For example, both queues and deques are kinds of containers.</li>\n<li><strong>Coroutines (C++ 20 and above):</strong> Allows a function to suspend execution and resume its task later</li>\n<li><strong>Filesystem (C++ 17 and above):</strong> Provides functionality needed to work with file systems on a local system</li>\n<li><strong>Input/Output:</strong> Makes it possible to access various forms of I/O, such as files, the console, and network streams</li>\n<li><strong>Iterators:</strong> Enumerates various kinds of data; Creates lists of items and manipulate them in specific ways.</li>\n<li><strong>Localization:</strong> Performs these tasks:\n<ul>\n<li>Character classification</li>\n<li>String collation</li>\n<li>Numeric, monetary, and date/time formatting and parsing</li>\n<li>Message retrieval</li>\n</ul>\n</li>\n<li><strong>Numerics:</strong> Provides access to all sorts of functions to perform math-related tasks</li>\n<li><strong>Ranges (C++ 20 and above):</strong> Works with views, which describe what you want to see as output, to enumerate, manipulate, and otherwise manage ranges of data</li>\n<li><strong>Regular Expressions (C++ 11 and above):</strong> Helps you look for patterns in strings</li>\n<li><strong>Strings:</strong> Makes strings easier to use by allowing data conversions, formatting, and other sorts of string manipulations</li>\n<li><strong>Thread Support (C++ 11 and above):</strong> Allows parallel and threaded execution of tasks</li>\n<li><strong>Utilities:</strong> Gives access to functions and types that perform small service tasks within the Standard Library</li>\n</ul>\n"},{"title":"Reasons to Use a Vector","thumb":null,"image":null,"content":"<p>Some people view vectors and arrays as essentially interchangeable. However, vectors are different from arrays, and you need to ensure that you know how to use them to code effectively. There are a number of advantages to using a vector instead of a regular, plain old, no-frills array:</p>\n<ul>\n<li>You don’t need to know up front how many items will be going in it. With an array, you need to know the size when you declare it.</li>\n<li>You don’t need to specifically deallocate a vector as you do a dynamically defined array.</li>\n<li>It’s possible to obtain the precise size of a vector, so you don’t need to pass the size of the vector to a function.</li>\n<li>When a vector is filled, the underlying code allocates additional memory automatically.</li>\n<li>You can return a vector from a function. To return an array, you must dynamically define it first.</li>\n<li>You can copy or assign a vector.</li>\n</ul>\n"}],"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":"Six months","lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":209511},{"headers":{"creationTime":"2016-03-26T11:10:10+00:00","modifiedTime":"2017-03-09T16:31:01+00:00","timestamp":"2022-09-14T18:17:48+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"Attaching to a Running Process Using Code::Blocks","strippedTitle":"attaching to a running process using code::blocks","slug":"attaching-to-a-running-process-using-codeblocks","canonicalUrl":"","seo":{"metaDescription":"Every time you start a new application, you create one or more processes. A process is simply executable code that is loaded into memory. The CPU reads and exec","noIndex":0,"noFollow":0},"content":"<p>Every time you start a new application, you create one or more processes. A <i>process</i> is simply executable code that is loaded into memory. The CPU reads and executes the instructions to perform the tasks you ask the application to do. When the CPU loads your application into memory, it assigns each process the application creates a <i>P</i>rocess <i>ID</i>entifier (PID), which is pronounced pid (think of lid with a p instead of an l). The PID is simply a number associated with the process for easy identification.</p>\r\n<p>In most cases, you debug an application by running it in the IDE in debug mode. However, there are some situations where you must debug the application in a different way — by attaching to its process. <i>Attaching</i><i> to the process</i> means telling the CPU to send the instructions in the executable code to a debugger before they're executed by the CPU. In other words, you place the debugger between the executable code and the CPU. Here are some of the most common reasons for performing this task:</p>\r\n<ul class=\"level-one\">\r\n <li><p class=\"first-para\">The executable code is behaving differently in the debugger than it does when executed as a regular application.</p>\r\n </li>\r\n <li><p class=\"first-para\">Instead of working with a debug version, you want to debug the release version.</p>\r\n </li>\r\n <li><p class=\"first-para\">It's important to see the disassembled code as it loads in memory.</p>\r\n </li>\r\n <li><p class=\"first-para\">You don't actually have source code to load into the debugger and execute.</p>\r\n </li>\r\n</ul>\r\n<p>There are many other reasons to attach to a running process, but these are the most common reasons. Of course, before you can attach to the process, you need to know the PID. Determining the PID depends on the platform you're using. Here are some common approaches:</p>\r\n<ul class=\"level-one\">\r\n <li><p class=\"first-para\"><b>Windows:</b> Look at the Processes tab of the Windows Task Manager</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Mac OS X:</b> Use the PS utility in the Terminal window or the Activity Monitor</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Linux:</b> Use the PS utility in the Terminal window</p>\r\n </li>\r\n</ul>\r\n<p>Once you have a PID, you can use it to attach to the process in Code::Blocks. The following steps get you started.</p>\r\n<ol class=\"level-one\">\r\n <li><p class=\"first-para\">Open your copy of Code::Blocks using a technique appropriate for your operating system.</p>\r\n<p class=\"child-para\">You see the Code::Blocks IDE open with the Start Here tab opened.</p>\r\n<img src=\"https://www.dummies.com/wp-content/uploads/433761.image0.jpg\" width=\"533\" height=\"400\" alt=\"Code Blocks start screen.\"/>\r\n </li>\r\n <li><p class=\"first-para\">Choose Debug→Attach to Process</p>\r\n<p class=\"child-para\">The Input Text dialog box appears.</p>\r\n<img src=\"https://www.dummies.com/wp-content/uploads/433762.image1.jpg\" width=\"535\" height=\"213\" alt=\"The Input Text dialog box in Code Blocks\"/>\r\n </li>\r\n <li><p class=\"first-para\">Type the PID in the PID to Attach To field and then click OK.</p>\r\n<p class=\"child-para\">You see the Debugger tab of the Logs and Others window appear. This tab contains information about the current process. You can type commands in the Command field to perform debugging tasks.</p>\r\n<img src=\"https://www.dummies.com/wp-content/uploads/433763.image2.jpg\" width=\"533\" height=\"400\" alt=\"The debugger window in Code Blocks.\"/>\r\n </li>\r\n</ol>\r\n<p>At this point, you can type commands in the Command field to perform debugging tasks. The most common commands are:</p>\r\n<ul class=\"level-one\">\r\n <li><p class=\"first-para\"><b>Break:</b> Stops application execution so you can examine the application state.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Step:</b> Steps one source line (which may be several assembly lines).</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Continue:</b> Restarts application execution.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Go:</b> Continues application execution to a specific point in the code.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Detach:</b> Detaches a previously attached PID so that you can safely shut the debugger down.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Help:</b> Displays additional command information.</p>\r\n </li>\r\n</ul>","description":"<p>Every time you start a new application, you create one or more processes. A <i>process</i> is simply executable code that is loaded into memory. The CPU reads and executes the instructions to perform the tasks you ask the application to do. When the CPU loads your application into memory, it assigns each process the application creates a <i>P</i>rocess <i>ID</i>entifier (PID), which is pronounced pid (think of lid with a p instead of an l). The PID is simply a number associated with the process for easy identification.</p>\r\n<p>In most cases, you debug an application by running it in the IDE in debug mode. However, there are some situations where you must debug the application in a different way — by attaching to its process. <i>Attaching</i><i> to the process</i> means telling the CPU to send the instructions in the executable code to a debugger before they're executed by the CPU. In other words, you place the debugger between the executable code and the CPU. Here are some of the most common reasons for performing this task:</p>\r\n<ul class=\"level-one\">\r\n <li><p class=\"first-para\">The executable code is behaving differently in the debugger than it does when executed as a regular application.</p>\r\n </li>\r\n <li><p class=\"first-para\">Instead of working with a debug version, you want to debug the release version.</p>\r\n </li>\r\n <li><p class=\"first-para\">It's important to see the disassembled code as it loads in memory.</p>\r\n </li>\r\n <li><p class=\"first-para\">You don't actually have source code to load into the debugger and execute.</p>\r\n </li>\r\n</ul>\r\n<p>There are many other reasons to attach to a running process, but these are the most common reasons. Of course, before you can attach to the process, you need to know the PID. Determining the PID depends on the platform you're using. Here are some common approaches:</p>\r\n<ul class=\"level-one\">\r\n <li><p class=\"first-para\"><b>Windows:</b> Look at the Processes tab of the Windows Task Manager</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Mac OS X:</b> Use the PS utility in the Terminal window or the Activity Monitor</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Linux:</b> Use the PS utility in the Terminal window</p>\r\n </li>\r\n</ul>\r\n<p>Once you have a PID, you can use it to attach to the process in Code::Blocks. The following steps get you started.</p>\r\n<ol class=\"level-one\">\r\n <li><p class=\"first-para\">Open your copy of Code::Blocks using a technique appropriate for your operating system.</p>\r\n<p class=\"child-para\">You see the Code::Blocks IDE open with the Start Here tab opened.</p>\r\n<img src=\"https://www.dummies.com/wp-content/uploads/433761.image0.jpg\" width=\"533\" height=\"400\" alt=\"Code Blocks start screen.\"/>\r\n </li>\r\n <li><p class=\"first-para\">Choose Debug→Attach to Process</p>\r\n<p class=\"child-para\">The Input Text dialog box appears.</p>\r\n<img src=\"https://www.dummies.com/wp-content/uploads/433762.image1.jpg\" width=\"535\" height=\"213\" alt=\"The Input Text dialog box in Code Blocks\"/>\r\n </li>\r\n <li><p class=\"first-para\">Type the PID in the PID to Attach To field and then click OK.</p>\r\n<p class=\"child-para\">You see the Debugger tab of the Logs and Others window appear. This tab contains information about the current process. You can type commands in the Command field to perform debugging tasks.</p>\r\n<img src=\"https://www.dummies.com/wp-content/uploads/433763.image2.jpg\" width=\"533\" height=\"400\" alt=\"The debugger window in Code Blocks.\"/>\r\n </li>\r\n</ol>\r\n<p>At this point, you can type commands in the Command field to perform debugging tasks. The most common commands are:</p>\r\n<ul class=\"level-one\">\r\n <li><p class=\"first-para\"><b>Break:</b> Stops application execution so you can examine the application state.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Step:</b> Steps one source line (which may be several assembly lines).</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Continue:</b> Restarts application execution.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Go:</b> Continues application execution to a specific point in the code.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Detach:</b> Detaches a previously attached PID so that you can safely shut the debugger down.</p>\r\n </li>\r\n <li><p class=\"first-para\"><b>Help:</b> Displays additional command information.</p>\r\n </li>\r\n</ul>","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}},{"authorId":9343,"name":"Jeff Cogswell","slug":"jeff-cogswell","description":"Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9343"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":196545,"title":"C++ Syntax that You May Have Forgotten","slug":"c-syntax-that-you-may-have-forgotten","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196545"}}],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221acc2df3b\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221acc2e55c\"></div></div>"},"articleType":{"articleType":"Articles","articleList":null,"content":null,"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":150975},{"headers":{"creationTime":"2016-03-27T09:35:35+00:00","modifiedTime":"2016-06-27T14:02:50+00:00","timestamp":"2022-09-14T18:15:07+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"How to Add the RegEx Library in C++","strippedTitle":"how to add the regex library in c++","slug":"how-to-add-the-regex-library-in-c","canonicalUrl":"","seo":{"metaDescription":"Most of the Boost library works just fine by adding headers to your application code. However, a few components, such as RegEx, require a library. Before you ca","noIndex":0,"noFollow":0},"content":"Most of the Boost library works just fine by adding headers to your application code. However, a few components, such as RegEx, require a library. Before you can use a library, you must build it. After you build the library, you must add it to your application.\r\n\r\nThere are two techniques for adding the required headers and libraries to an application. The first technique is to add it to the compiler settings. The second technique is to add the settings to a specific project.\r\n\r\nYou use the first technique when you work with Boost for a large number of projects and require access to all libraries. The second technique is best when you use Boost only for specific projects and require access only to specific libraries.\r\n\r\nThe following steps show you how to perform the project-specific setup for any library, not just the RegEx library:","description":"Most of the Boost library works just fine by adding headers to your application code. However, a few components, such as RegEx, require a library. Before you can use a library, you must build it. After you build the library, you must add it to your application.\r\n\r\nThere are two techniques for adding the required headers and libraries to an application. The first technique is to add it to the compiler settings. The second technique is to add the settings to a specific project.\r\n\r\nYou use the first technique when you work with Boost for a large number of projects and require access to all libraries. The second technique is best when you use Boost only for specific projects and require access only to specific libraries.\r\n\r\nThe following steps show you how to perform the project-specific setup for any library, not just the RegEx library:","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}},{"authorId":9343,"name":"Jeff Cogswell","slug":"jeff-cogswell","description":"Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9343"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":196545,"title":"C++ Syntax that You May Have Forgotten","slug":"c-syntax-that-you-may-have-forgotten","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196545"}},{"articleId":196543,"title":"The 10 Most Common C++ Mistakes","slug":"the-10-most-common-c-mistakes","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196543"}}],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}},{"articleId":200134,"title":"Expressing Binary Numbers in C++","slug":"expressing-binary-numbers-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/200134"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221a2b4794d\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221a2b47ed9\"></div></div>"},"articleType":{"articleType":"Step by Step","articleList":null,"content":[{"title":"Use the Project wizard to create a new project.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>Every application begins with a new project.</p>\n"},{"title":"Choose Project→Build Options.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>Code::Blocks displays the Project Build Options dialog box.</p>\n"},{"title":"Select the Linker Settings tab.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see a number of linker settings, including a Link Libraries list, which will be blank.</p>\n"},{"title":"Click Add.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448693.medium.jpg","width":200,"height":58},"image":{"src":"https://www.dummies.com/wp-content/uploads/448689.image0.jpg","width":533,"height":157},"content":"<p>Code::Blocks displays the Add Library dialog box.</p>\n"},{"title":"Click the Browse button — the button sporting the ellipses.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see the Choose Library to Link dialog box.</p>\n"},{"title":"Using the dialog box, navigate to thelibboost_regex-mgw47-mt-1_55.alibrary (the release version of the library), select the library, and then click OK.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>The Boost library files are typically located in the <span class=\"code\">Boostlib</span> directory. When you click OK, you see a dialog box that asks whether you want to keep this as a relative path.</p>\n<p><i>Relative paths</i> specify a location using the current location as a starting point. The alternative is an <i>absolute path</i>, which specifies a location based on the root directory of your hard drive. In most cases, absolute paths are less likely to get broken.</p>\n"},{"title":"Click No.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see the absolute path for the <span class=\"code\">libboost_regex-mgw47-mt-1_55.a</span> library added to the File field of the Add Library dialog box.</p>\n"},{"title":"Click OK.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448694.medium.jpg","width":200,"height":143},"image":{"src":"https://www.dummies.com/wp-content/uploads/448690.image1.jpg","width":535,"height":384},"content":"<p>After you click OK, you see the absolute path for the library added to the Linker Settings.</p>\n"},{"title":"Click the Search Directories tab.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see three sub-tabs: Compiler, Linker, and Resource Compiler.</p>\n"},{"title":"Click Add in the Compiler sub-tab.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448695.medium.jpg","width":200,"height":58},"image":{"src":"https://www.dummies.com/wp-content/uploads/448691.image2.jpg","width":533,"height":157},"content":"<p>You see an Add Directory dialog box like the one shown.</p>\n"},{"title":"Type the location of the Boost header files in the Directory field.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>As an alternative, you can click the Browse button to use a Browse for Folder dialog box to find them. The files are normally located in the <span class=\"code\">Boostincludeboost-1_55</span> folder.</p>\n"},{"title":"Click OK.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448696.medium.jpg","width":200,"height":143},"image":{"src":"https://www.dummies.com/wp-content/uploads/448692.image3.jpg","width":535,"height":384},"content":"<p>You see the search folder added to the Compiler tab as shown.</p>\n"},{"title":"Click Add in the Linker sub-tab.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see yet another Add Directory dialog box.</p>\n"},{"title":"Type the location of the Boost library files in the Directory field and then click OK.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>The Boost library files are typically located in the <span class=\"code\">Boostlib </span>directory. After you click OK, you see the directory added to the Linker tab.</p>\n"},{"title":"Click OK.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>The RegEx library is now ready for inclusion in your application.</p>\n"}],"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":203475},{"headers":{"creationTime":"2016-03-27T09:35:41+00:00","modifiedTime":"2016-06-27T14:02:15+00:00","timestamp":"2022-09-14T18:15:07+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"How to Configure the Library Project in C++","strippedTitle":"how to configure the library project in c++","slug":"how-to-configure-the-library-project-in-c","canonicalUrl":"","seo":{"metaDescription":"The static library starts with a standard C file. To make this library work well with templates, you need to delete the C file, add a C++ file, and add a header","noIndex":0,"noFollow":0},"content":"The static library starts with a standard C file. To make this library work well with templates, you need to delete the C file, add a C++ file, and add a header file. The following steps describe how to perform this process:","description":"The static library starts with a standard C file. To make this library work well with templates, you need to delete the C file, add a C++ file, and add a header file. The following steps describe how to perform this process:","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}},{"authorId":9343,"name":"Jeff Cogswell","slug":"jeff-cogswell","description":"Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9343"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":196545,"title":"C++ Syntax that You May Have Forgotten","slug":"c-syntax-that-you-may-have-forgotten","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196545"}},{"articleId":196543,"title":"The 10 Most Common C++ Mistakes","slug":"the-10-most-common-c-mistakes","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196543"}}],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}},{"articleId":200134,"title":"Expressing Binary Numbers in C++","slug":"expressing-binary-numbers-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/200134"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221a2b2e99d\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221a2b2ef33\"></div></div>"},"articleType":{"articleType":"Step by Step","articleList":null,"content":[{"title":"Right-click <span class=\"code\">main.c</span> in the Projects tab of the Management window and choose Remove File From Project from the context menu that appears.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>Code::Blocks removes the file from the project tree.</p>\n"},{"title":"Choose File→New→File.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448683.medium.jpg","width":200,"height":147},"image":{"src":"https://www.dummies.com/wp-content/uploads/448681.image0.jpg","width":535,"height":394},"content":"<p>You see the New from Template dialog box shown.</p>\n"},{"title":"Highlight the C/C++ Header icon and click Go.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see the Welcome page of the C/C++ Header wizard.</p>\n"},{"title":"Click Next.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448684.medium.jpg","width":200,"height":167},"image":{"src":"https://www.dummies.com/wp-content/uploads/448682.image1.jpg","width":479,"height":400},"content":"<p>The wizard asks you to provide the header configuration information.</p>\n"},{"title":"In the Filename with Full Path field, type <span class=\"code\">MathLibrary.h</span>, click the ellipses button, and then click Save.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>Code::Blocks adds the complete project path to the filename you chose. Notice that Code::Blocks also supplies an entry for the Header Guard Word field. This word ensures that the header isn’t added more than once to a project.</p>\n"},{"title":"Click All, and then click Finish.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>The C/C++ Source wizard adds the file to your project. You’re ready to begin creating a template library.</p>\n"}],"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":203476},{"headers":{"creationTime":"2016-03-27T09:35:45+00:00","modifiedTime":"2016-06-27T14:01:37+00:00","timestamp":"2022-09-14T18:15:07+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"How to Create a Library Project in C++","strippedTitle":"how to create a library project in c++","slug":"how-to-create-a-library-project-in-c","canonicalUrl":"","seo":{"metaDescription":"Creating a library project in C++ is only a little different than creating a console application. The following steps describe how to create a library project:","noIndex":0,"noFollow":0},"content":"Creating a library project in C++ is only a little different than creating a console application. The following steps describe how to create a library project:","description":"Creating a library project in C++ is only a little different than creating a console application. The following steps describe how to create a library project:","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}},{"authorId":9343,"name":"Jeff Cogswell","slug":"jeff-cogswell","description":"Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9343"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":196545,"title":"C++ Syntax that You May Have Forgotten","slug":"c-syntax-that-you-may-have-forgotten","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196545"}},{"articleId":196543,"title":"The 10 Most Common C++ Mistakes","slug":"the-10-most-common-c-mistakes","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196543"}}],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}},{"articleId":200134,"title":"Expressing Binary Numbers in C++","slug":"expressing-binary-numbers-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/200134"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221a2b1182a\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-63221a2b16b09\"></div></div>"},"articleType":{"articleType":"Step by Step","articleList":null,"content":[{"title":"Choose File→New→Project.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448676.medium.jpg","width":200,"height":147},"image":{"src":"https://www.dummies.com/wp-content/uploads/448673.image0.jpg","width":535,"height":394},"content":"<p>You see the New From Template dialog box shown.</p>\n"},{"title":"Highlight the Static Library icon on the Projects tab, then click Go.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>You see the Welcome page of the Static Library wizard.</p>\n"},{"title":"Click Next.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448677.medium.jpg","width":200,"height":168},"image":{"src":"https://www.dummies.com/wp-content/uploads/448674.image1.jpg","width":474,"height":400},"content":"<p>You see a list of project-related questions. These questions define project basics, such as the project name.</p>\n"},{"title":"Type a name for your project in the Project Title field.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>The example uses <span class=\"code\">MathLibrary</span> as the project title. Notice that the wizard automatically starts creating an entry for you in the Project Filename field.</p>\n"},{"title":"Type a location for your project in the Folder to Create Project In field.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>(Optional) Type a project filename in the Project Filename field.</p>\n"},{"title":"Click Next.","thumb":{"src":"https://www.dummies.com/wp-content/uploads/448678.medium.jpg","width":200,"height":168},"image":{"src":"https://www.dummies.com/wp-content/uploads/448675.image2.jpg","width":474,"height":400},"content":"<p>You see the compiler settings shown. This example uses the default compiler settings. However, it’s important to remember that you can choose a different compiler, modify the locations of the debug and release versions of the project, and make other changes as needed. Code::Blocks provides the same level of customization for libraries as it does for applications.</p>\n"},{"title":"Change any required compiler settings and click Finish.","thumb":{"src":null,"width":0,"height":0},"image":{"src":null,"width":0,"height":0},"content":"<p>The wizard creates the application for you. It then displays the Code::Blocks IDE with the project loaded. Note that the Static Library project includes some sample code to get you started. You could compile this library and test it now.</p>\n"}],"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":203477},{"headers":{"creationTime":"2016-03-26T22:54:42+00:00","modifiedTime":"2016-03-26T22:54:42+00:00","timestamp":"2022-09-14T18:12:00+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"An Introduction to C++","strippedTitle":"an introduction to c++","slug":"an-introduction-to-c","canonicalUrl":"","seo":{"metaDescription":"The C++ programming language consists of a vocabulary of commands that humans can understand and that can be converted into machine language fairly easily and a","noIndex":0,"noFollow":0},"content":"<p>The C++ programming language consists of a vocabulary of commands that humans can understand and that can be converted into machine language fairly easily and a language structure (or <i>grammar</i>) that allows humans to combine these C++ commands into a program that actually does something (well, <i>maybe</i> does something)</p>\n<p class=\"Remember\">The vocabulary is often known as the semantics, while the grammar is the syntax.</p>\n<h2 id=\"tab1\" >What's a program?</h2>\n<p>A C++ program is a text file containing a sequence of C++ commands put together according to the laws of C++ grammar. This text file is known as the <i>source file </i>. A C++ source file carries the extension .CPP just as a Microsoft Word file ends in .DOC or an MS-DOS batch file ends in .BAT. The concept extension .CPP is just a convention, but it's used almost exclusively in the PC world.</p>\n<p>The point of programming is to write a sequence of C++ commands that can be converted into a machine language program that does whatever it is that you want done. Such machine executable programs carry the extension .EXE. The act of creating an executable program from a C++ program is called <i>compiling </i>(or building — there is a difference, but it's small).</p>\n<h2 id=\"tab2\" >How do I program?</h2>\n<p>To write a program, you need two things: an editor to build your .<i>CPP</i> source file with and a program that converts your source file into a machine executable .<i>EXE</i> file to carry out your commands<i>. </i>The tool that does the conversion is known as a <i>compiler</i>.</p>\n<p>Nowadays, tool developers generally combine the compiler with an editor into a single work-environment package. After entering your program, you need only click a button to create the executable file.</p>\n<p>The most popular of all C++ environments is Microsoft's Visual C++, but the software is expensive. Fortunately, there are public domain C++ environments — the most popular of which is GNU C++. (Pronounce GNU like this: guh NEW). You can download public domain programs from the Internet. Some of these programs are not free — you are either encouraged to or required to pay some usually small fee. You do not have to pay to use GNU C++.</p>\n<p class=\"TechnicalStuff\">GNU stands for the circular definition \"GNU is Not UNIX.\" This joke goes way back to the early days of C++ — just accept it as is. GNU is a series of tools built by the Free Software Foundation.</p>\n<p>GNU C++ is not some bug-ridden, limited edition C++ compiler from some fly-by-night group of developers. GNU C++ is a full-fledged C++ environment. GNU C++ supports the entire C++ language and executes all C++ programs.</p>\n<p class=\"Warning\">GNU C++ is not a Windows development package for the Windows environment. You'll have to break open the wallet and go for a commercial package like Visual C++.</p>","description":"<p>The C++ programming language consists of a vocabulary of commands that humans can understand and that can be converted into machine language fairly easily and a language structure (or <i>grammar</i>) that allows humans to combine these C++ commands into a program that actually does something (well, <i>maybe</i> does something)</p>\n<p class=\"Remember\">The vocabulary is often known as the semantics, while the grammar is the syntax.</p>\n<h2 id=\"tab1\" >What's a program?</h2>\n<p>A C++ program is a text file containing a sequence of C++ commands put together according to the laws of C++ grammar. This text file is known as the <i>source file </i>. A C++ source file carries the extension .CPP just as a Microsoft Word file ends in .DOC or an MS-DOS batch file ends in .BAT. The concept extension .CPP is just a convention, but it's used almost exclusively in the PC world.</p>\n<p>The point of programming is to write a sequence of C++ commands that can be converted into a machine language program that does whatever it is that you want done. Such machine executable programs carry the extension .EXE. The act of creating an executable program from a C++ program is called <i>compiling </i>(or building — there is a difference, but it's small).</p>\n<h2 id=\"tab2\" >How do I program?</h2>\n<p>To write a program, you need two things: an editor to build your .<i>CPP</i> source file with and a program that converts your source file into a machine executable .<i>EXE</i> file to carry out your commands<i>. </i>The tool that does the conversion is known as a <i>compiler</i>.</p>\n<p>Nowadays, tool developers generally combine the compiler with an editor into a single work-environment package. After entering your program, you need only click a button to create the executable file.</p>\n<p>The most popular of all C++ environments is Microsoft's Visual C++, but the software is expensive. Fortunately, there are public domain C++ environments — the most popular of which is GNU C++. (Pronounce GNU like this: guh NEW). You can download public domain programs from the Internet. Some of these programs are not free — you are either encouraged to or required to pay some usually small fee. You do not have to pay to use GNU C++.</p>\n<p class=\"TechnicalStuff\">GNU stands for the circular definition \"GNU is Not UNIX.\" This joke goes way back to the early days of C++ — just accept it as is. GNU is a series of tools built by the Free Software Foundation.</p>\n<p>GNU C++ is not some bug-ridden, limited edition C++ compiler from some fly-by-night group of developers. GNU C++ is a full-fledged C++ environment. GNU C++ supports the entire C++ language and executes all C++ programs.</p>\n<p class=\"Warning\">GNU C++ is not a Windows development package for the Windows environment. You'll have to break open the wallet and go for a commercial package like Visual C++.</p>","blurb":"","authors":[],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[{"label":"What's a program?","target":"#tab1"},{"label":"How do I program?","target":"#tab2"}],"relatedArticles":{"fromBook":[],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":200134,"title":"Expressing Binary Numbers in C++","slug":"expressing-binary-numbers-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/200134"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":0,"slug":null,"isbn":null,"categoryList":null,"amazon":null,"image":null,"title":null,"testBankPinActivationLink":null,"bookOutOfPrint":false,"authorsInfo":null,"authors":null,"_links":null},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[null]}]\" id=\"du-slot-6322197076e13\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[null]}]\" id=\"du-slot-6322197077680\"></div></div>"},"articleType":{"articleType":"Articles","articleList":null,"content":null,"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":201132},{"headers":{"creationTime":"2016-03-26T22:47:31+00:00","modifiedTime":"2016-03-26T22:47:31+00:00","timestamp":"2022-09-14T18:11:47+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"Expressing Binary Numbers in C++","strippedTitle":"expressing binary numbers in c++","slug":"expressing-binary-numbers-in-c","canonicalUrl":"","seo":{"metaDescription":"C++ variables are stored internally as so-called binary numbers. Binary numbers are stored as a sequence of 1 and 0 values known as bits. Most of the time, you ","noIndex":0,"noFollow":0},"content":"<p>C++ variables are stored internally as so-called binary numbers. <i>Binary numbers</i> are stored as a sequence of 1 and 0 values known as <i>bits.</i> Most of the time, you don't really need to deal with numbers at the bit level; however, there are occasions when doing so is convenient. C++ provides a set of operators for this purpose.</p>\n<p>The so-called bitwise logical operators operate on their arguments at the bit level. To understand how they work, examine how computers store variables.</p>\n<h2 id=\"tab1\" >The decimal number system</h2>\n<p>The numbers that you are familiar with are known as <i>decimal numbers </i>because they are based on the number 10. In general, the programmer expresses C++ variables as decimal numbers. Thus, you would say that the value of <b>var</b> is 123, for example.</p>\n<p>A number such as 123 refers to <b>1 * 100 + 2 * 10 + 3 * 1</b>. Each of these base numbers — 100, 10, and 1 — is a power of 10.</p>\n<p class=\"article-code\">123 = 1 * 100 + 2 * 10 + 3 * 1</p>\n<p>Expressed in a slightly different but equivalent way:</p>\n<p class=\"article-code\">123 = 1 * 10<sup>2</sup> + 2 * 10<sup>1</sup> + 3 * 10<sup>0</sup></p>\n<p class=\"Remember\">Remember that any number to the zero power is 1.</p>\n<h2 id=\"tab2\" >Other number systems </h2>\n<p>The use of a base number of 10 for the counting system stems, in all probability, from the fact that humans have 10 fingers, the original counting tools. The alternative would have been base 20.</p>\n<p>If dogs had invented our numbering scheme, it may well have been based on the numeral 8 (one digit of each paw is out of sight on the back part of the leg). Such an <i>octal</i> system would have worked just as well:</p>\n<p class=\"article-code\">123<sub>10</sub> = 1 * 8<sup>2</sup> + 7 * 8<sup>1</sup> + 3 * 8<sup>0</sup> = 173<sub>8</sub></p>\n<p>The small 10 and 8 here refer to the numbering system, 10 for decimal (base 10) and 8 for octal (base 8). A counting system may use any positive base.</p>\n<h2 id=\"tab3\" >The binary number system</h2>\n<p>Computers have essentially two fingers. (Maybe that's why computers are so stupid: Without an opposable thumb, they can't grasp anything. And then again, maybe not.) Computers prefer counting using base 2. The number 123<SUB>10</SUB> would be expressed as:</p>\n<p class=\"article-code\">123<sub>10</sub> = 0*128 + 1*64 + 1*32 + 1*16 + 1*8 + 0*4 +1*2 + 1*1<br /> = 01111011<sub>2</sub></p>\n<p>It is always convention to express binary numbers by using 4, 8, 32, or 64 binary digits even if the leading digits are zero. This is also because of the way computers are built internally.</p>\n<p class=\"TechnicalStuff\">Because the term <i>digit</i> refers to a multiple of ten, a binary digit is called a <i>bit</i>. The term stems from binary (b-) digit (-it). Eight bits make up a byte. A word is usually either two or four bytes.</p>\n<p>With such a small base, it is necessary to use a large number of bits to express numbers. It is inconvenient to use an expression such as 01111011<SUB>2</SUB> to express such a mundane value as 123<SUB>10</SUB>. Programmers prefer to express numbers by units of bytes, or eight bits.</p>\n<p>A single, four-bit digit is essentially base 16, because four bits can express up to any value from 0 to 15. Base 16 is known as the <i>hexadecimal </i>counting system. Hexadecimal is often contracted to simply <i>hex.</i></p>\n<p>Hexadecimal uses the same digits for the numbers 0 through 9. For the digits between 9 and 16, hexadecimal uses the first six letters of the alphabet: A for 10, B for 11, and so on. Thus, 123<SUB>10</SUB> becomes 7B<SUB>16</SUB>.</p>\n<p class=\"article-code\">123 = 7 * 16<sup>1</sup> + B (i.e., 11) * 16<sup>0</sup> = 7B<sub>16</sub></p>\n<p>Because programmers prefer to express numbers in 4, 8, 32, or 64 bits, they similarly prefer to express hexadecimal numbers in 1, 2, 4, or 8 hexadecimal digits even when the leading digits are 0.</p>\n<p>Finally, it is inconvenient to express a hexadecimal number such as 7B<SUB>16</SUB> using a subscript, because terminals don't support subscripts. Even on a word processor, it is inconvenient to change fonts to and from subscript mode just to type two digits. Therefore, programmers use the convention of beginning a hexadecimal number with a 0x (the reason for such a strange conviction goes back to the early days of C). Thus, 7B becomes 0x7B. Using this convention, 0x7B is equal to 123 (while 0x123 is equal to 291.)</p>\n<p>All of the mathematical operators can be performed on hexadecimal numbers in the same way that they are applied to decimal numbers. The reason that we can't perform a multiplication such as 0xC * 0xE in our heads has more to do with the multiplication tables we learned in school than on any limitation in the number system.</p>","description":"<p>C++ variables are stored internally as so-called binary numbers. <i>Binary numbers</i> are stored as a sequence of 1 and 0 values known as <i>bits.</i> Most of the time, you don't really need to deal with numbers at the bit level; however, there are occasions when doing so is convenient. C++ provides a set of operators for this purpose.</p>\n<p>The so-called bitwise logical operators operate on their arguments at the bit level. To understand how they work, examine how computers store variables.</p>\n<h2 id=\"tab1\" >The decimal number system</h2>\n<p>The numbers that you are familiar with are known as <i>decimal numbers </i>because they are based on the number 10. In general, the programmer expresses C++ variables as decimal numbers. Thus, you would say that the value of <b>var</b> is 123, for example.</p>\n<p>A number such as 123 refers to <b>1 * 100 + 2 * 10 + 3 * 1</b>. Each of these base numbers — 100, 10, and 1 — is a power of 10.</p>\n<p class=\"article-code\">123 = 1 * 100 + 2 * 10 + 3 * 1</p>\n<p>Expressed in a slightly different but equivalent way:</p>\n<p class=\"article-code\">123 = 1 * 10<sup>2</sup> + 2 * 10<sup>1</sup> + 3 * 10<sup>0</sup></p>\n<p class=\"Remember\">Remember that any number to the zero power is 1.</p>\n<h2 id=\"tab2\" >Other number systems </h2>\n<p>The use of a base number of 10 for the counting system stems, in all probability, from the fact that humans have 10 fingers, the original counting tools. The alternative would have been base 20.</p>\n<p>If dogs had invented our numbering scheme, it may well have been based on the numeral 8 (one digit of each paw is out of sight on the back part of the leg). Such an <i>octal</i> system would have worked just as well:</p>\n<p class=\"article-code\">123<sub>10</sub> = 1 * 8<sup>2</sup> + 7 * 8<sup>1</sup> + 3 * 8<sup>0</sup> = 173<sub>8</sub></p>\n<p>The small 10 and 8 here refer to the numbering system, 10 for decimal (base 10) and 8 for octal (base 8). A counting system may use any positive base.</p>\n<h2 id=\"tab3\" >The binary number system</h2>\n<p>Computers have essentially two fingers. (Maybe that's why computers are so stupid: Without an opposable thumb, they can't grasp anything. And then again, maybe not.) Computers prefer counting using base 2. The number 123<SUB>10</SUB> would be expressed as:</p>\n<p class=\"article-code\">123<sub>10</sub> = 0*128 + 1*64 + 1*32 + 1*16 + 1*8 + 0*4 +1*2 + 1*1<br /> = 01111011<sub>2</sub></p>\n<p>It is always convention to express binary numbers by using 4, 8, 32, or 64 binary digits even if the leading digits are zero. This is also because of the way computers are built internally.</p>\n<p class=\"TechnicalStuff\">Because the term <i>digit</i> refers to a multiple of ten, a binary digit is called a <i>bit</i>. The term stems from binary (b-) digit (-it). Eight bits make up a byte. A word is usually either two or four bytes.</p>\n<p>With such a small base, it is necessary to use a large number of bits to express numbers. It is inconvenient to use an expression such as 01111011<SUB>2</SUB> to express such a mundane value as 123<SUB>10</SUB>. Programmers prefer to express numbers by units of bytes, or eight bits.</p>\n<p>A single, four-bit digit is essentially base 16, because four bits can express up to any value from 0 to 15. Base 16 is known as the <i>hexadecimal </i>counting system. Hexadecimal is often contracted to simply <i>hex.</i></p>\n<p>Hexadecimal uses the same digits for the numbers 0 through 9. For the digits between 9 and 16, hexadecimal uses the first six letters of the alphabet: A for 10, B for 11, and so on. Thus, 123<SUB>10</SUB> becomes 7B<SUB>16</SUB>.</p>\n<p class=\"article-code\">123 = 7 * 16<sup>1</sup> + B (i.e., 11) * 16<sup>0</sup> = 7B<sub>16</sub></p>\n<p>Because programmers prefer to express numbers in 4, 8, 32, or 64 bits, they similarly prefer to express hexadecimal numbers in 1, 2, 4, or 8 hexadecimal digits even when the leading digits are 0.</p>\n<p>Finally, it is inconvenient to express a hexadecimal number such as 7B<SUB>16</SUB> using a subscript, because terminals don't support subscripts. Even on a word processor, it is inconvenient to change fonts to and from subscript mode just to type two digits. Therefore, programmers use the convention of beginning a hexadecimal number with a 0x (the reason for such a strange conviction goes back to the early days of C). Thus, 7B becomes 0x7B. Using this convention, 0x7B is equal to 123 (while 0x123 is equal to 291.)</p>\n<p>All of the mathematical operators can be performed on hexadecimal numbers in the same way that they are applied to decimal numbers. The reason that we can't perform a multiplication such as 0xC * 0xE in our heads has more to do with the multiplication tables we learned in school than on any limitation in the number system.</p>","blurb":"","authors":[],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[{"label":"The decimal number system","target":"#tab1"},{"label":"Other number systems ","target":"#tab2"},{"label":"The binary number system","target":"#tab3"}],"relatedArticles":{"fromBook":[],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":0,"slug":null,"isbn":null,"categoryList":null,"amazon":null,"image":null,"title":null,"testBankPinActivationLink":null,"bookOutOfPrint":false,"authorsInfo":null,"authors":null,"_links":null},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[null]}]\" id=\"du-slot-632219632dfd2\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[null]}]\" id=\"du-slot-632219632e85f\"></div></div>"},"articleType":{"articleType":"Articles","articleList":null,"content":null,"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Solve","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":200134},{"headers":{"creationTime":"2016-03-26T22:38:42+00:00","modifiedTime":"2016-03-26T22:38:42+00:00","timestamp":"2022-09-14T18:11:31+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"Working with Functions in C++","strippedTitle":"working with functions in c++","slug":"working-with-functions-in-c","canonicalUrl":"","seo":{"metaDescription":"Developers often need the ability to break programs up into smaller chunks that are easier to develop. \"Real world\" programs can be many of thousands (or millio","noIndex":0,"noFollow":0},"content":"<p>Developers often need the ability to break programs up into smaller chunks that are easier to develop. \"Real world\" programs can be many of thousands (or millions!) of lines long. Without this ability to divide the program into parts, developing such large programs would quickly become impossible.</p>\n<p>C++ allows programmers to divide their code up into chunks known as <i>functions.</i> A function with a simple description and a well-defined interface to the outside world can be written and debugged without worrying about the code that surrounds it.</p>\n<h2 id=\"tab1\" >Overloading function names</h2>\n<p>C++ allows the programmer to assign the same name to two or more functions. This multiple use of names is known as <i>overloading functions</i> or, simply, <i>overloading</i>.</p>\n<p>In general, two functions in a single program cannot share the same name. If they did, C++ would have no way to distinguish them.</p>\n<p>However, the name of the function includes the number and type of its arguments. (The name of the function does not include its return argument.) Thus, the following are not the same functions:</p>\n<p class=\"article-code\">void someFunction(void)<br />{<br /> // ....perform some function<br />}<br />void someFunction(int n)<br />{<br /> // ...perform some different function<br />}<br />void someFunction(double d)<br />{<br /> // ...perform some very different function<br />}<br />void someFunction(int n1, int n2)<br />{<br /> // ....do something different yet<br />}</p>\n<p>C++ still knows that the functions <b>someFunction(void),</b> <b>someFunction(int),</b> <b>someFunction(double),</b> and <b>someFunction(int, int)</b> are not the same. Like so many things that deal with computers, this has an analogy in the human world.</p>\n<p><b>void </b>as an argument type is optional. <b>sumFunction(void)</b> and <b>sumFunction()</b> are the same function. A function has a shorthand name, such as <b>someFunction(). </b>As long as we use the entire name, no one gets confused — no matter how many <b>someFunctions</b> there may be. The full name for one of the <b>someFunctions()</b>is <b>someFunction(int)</b>. As long as this full name is unique, no confusion occurs.</p>\n<p>A typical application may appear as follows:</p>\n<p class=\"article-code\">int intVariable1, intVariable2; // equivalent to<br /> // int Variable1;<br /> // int Variable2;<br />double doubleVariable;<br />// functions are distinguished by the type of<br />// the argument passed<br />someFunction(); // calls someFunction(void)<br />someFunction(intVariable1); // calls someFunction(int)<br />someFunction(doubleVariable); // calls someFunction(double)<br />someFunction(intVariable1, intVariable2); // calls <br /> // someFunction(int, int)<br />// this works for constants as well<br />someFunction(1); // calls someFunction(int)<br />someFunction(1.0); // calls someFunction(double)<br />someFunction(1, 2); // calls someFunction(int, int)</p>\n<p>In each case, the type of the arguments matches the full name of the three functions.</p>\n<p class=\"Warning\">The return type is not part of the extended name (also known as the <i>function signature</i>) of the function. The following two functions have the same name and, thus, cannot be part of the same program:</p>\n<p class=\"article-code\">int someFunction(int n); // full name of the function <br /> // is someFunction(int)<br />double someFunction(int n); // same name</p>\n<p class=\"Remember\">The following is acceptable:</p>\n<p class=\"article-code\">int someFunction(int n);<br />double d = someFunction(10); // promote returned value</p>\n<p>The <b>int</b> returned by <b>someFunction()</b> is promoted into a <b>double.</b> Thus, the following would be confusing:</p>\n<p class=\"article-code\">int someFunction(int n);<br />double someFunction(int n);<br />double d = someFunction(10);// promote returned int?<br /> // or use returned double as is</p>\n<p>C++ would know whether to use the value returned from the <b>double</b> version of <b>someFunction()</b> or promote the value returned from <b>int</b> version.</p>\n<h2 id=\"tab2\" >Defining function prototypes</h2>\n<p>The programmer may provide the remainder of a C++ source file, or module, the extended name (the name and functions) during the definition of the function. </p>\n<p>A function may be defined anywhere in the module. (A <i>module</i> is another name for a C++ source file.) However, something has to tell <b>main()</b> the full name of the function before it can be called. Consider the following code snippet:</p>\n<p class=\"article-code\">int main(int argc, char* pArgs[])<br />{<br /> someFunc(1, 2);<br />}<br />int someFunc(double arg1, int arg2)<br />{<br /> // ...do something<br />}</p>\n<p>The call to <b>someFunc()</b> from within <b>main()</b> doesn't know the full name of the function. It may surmise from the arguments that the name is <b>someFunc(int, int)</b> and that its return type is void; however, as you can see, this is incorrect.</p>\n<p>C++ could be less lazy and look ahead to determine the full name of <b>someFunc()</b>s on its own, but it doesn't. What is needed is some way to inform <b>main()</b> of the full name of <b>someFunc()</b> before it is used. What is needed is a before use function declaration. Some type of prototype is necessary.</p>\n<p>A <i>prototype declaration</i> appears the same as a function with no body. In use, a prototype declaration appears as follows:</p>\n<p class=\"article-code\">int someFunc(double, int);<br />int main(int argc, char* pArgs[])<br />{<br /> someFunc(1, 2);<br />}<br />int someFunc(double arg1, int arg2)<br />{<br /> // ...do something<br />}</p>\n<p>The prototype declaration tells the world (at least that part of the world after the declaration), that the extended name for <b>someFunc()</b> is <b>someFunction(double, int). </b>The call in <b>main()</b> now knows to cast the 1 to a double before making the call. In addition, <b>main()</b> knows that the value returned by <b>someFunc()</b> is an <b>int</b>.</p>\n<p class=\"Tip\">A function call that returns a value is an <i>expression.</i> As with any other provide expression, you are allowed to throw the value returned by a function.</p>\n<h2 id=\"tab3\" >Variable storage types</h2>\n<p>Function variables are stored in three different places. Variables declared within a function are said to be local. In the following example, the variable <b>localVariable</b> is local to the function <b>fn()</b>:</p>\n<p class=\"article-code\">int globalVariable;<br />void fn()<br />{<br /> int localVariable;<br /> static int staticVariable;<br />}</p>\n<p>The variable <b>localVariable</b> doesn't exist until the function <b>fn()</b> is called. <b>localVariable</b> ceases to exist when the function returns. Upon return, whatever value that is stored in <b>localVariable</b> is lost. In addition, only <b>fn()</b> has access to <b>localVariable</b> — other functions cannot reach into the function to access it.</p>\n<p>By comparison, the variable <b>globalVariable</b> exists as long as the program is running. All functions have access to <b>globalVariable</b> all of the time.</p>\n<p>The static variable <b>staticVariable</b> is something of a mix between a local and a global variable. The variable <b>staticVariable</b> is created when execution first reaches the declaration (roughly, when the function <b>fn()</b> is called). In addition, <b>staticVariable</b> is only accessible within <b>fn()</b>. Unlike <b>localVariable</b>, however, <b>staticVariable</b> continues to exist even after the program returns from <b>fn()</b>. If <b>fn()</b> assigns a value to <b>staticVariable</b> once, it will still be there the next time that <b>fn()</b> is called.</p>\n<p>In case anyone asks, there is a fourth type, <b>auto</b>, but today it has the same meaning as <b>local,</b> so just ignore them.</p>","description":"<p>Developers often need the ability to break programs up into smaller chunks that are easier to develop. \"Real world\" programs can be many of thousands (or millions!) of lines long. Without this ability to divide the program into parts, developing such large programs would quickly become impossible.</p>\n<p>C++ allows programmers to divide their code up into chunks known as <i>functions.</i> A function with a simple description and a well-defined interface to the outside world can be written and debugged without worrying about the code that surrounds it.</p>\n<h2 id=\"tab1\" >Overloading function names</h2>\n<p>C++ allows the programmer to assign the same name to two or more functions. This multiple use of names is known as <i>overloading functions</i> or, simply, <i>overloading</i>.</p>\n<p>In general, two functions in a single program cannot share the same name. If they did, C++ would have no way to distinguish them.</p>\n<p>However, the name of the function includes the number and type of its arguments. (The name of the function does not include its return argument.) Thus, the following are not the same functions:</p>\n<p class=\"article-code\">void someFunction(void)<br />{<br /> // ....perform some function<br />}<br />void someFunction(int n)<br />{<br /> // ...perform some different function<br />}<br />void someFunction(double d)<br />{<br /> // ...perform some very different function<br />}<br />void someFunction(int n1, int n2)<br />{<br /> // ....do something different yet<br />}</p>\n<p>C++ still knows that the functions <b>someFunction(void),</b> <b>someFunction(int),</b> <b>someFunction(double),</b> and <b>someFunction(int, int)</b> are not the same. Like so many things that deal with computers, this has an analogy in the human world.</p>\n<p><b>void </b>as an argument type is optional. <b>sumFunction(void)</b> and <b>sumFunction()</b> are the same function. A function has a shorthand name, such as <b>someFunction(). </b>As long as we use the entire name, no one gets confused — no matter how many <b>someFunctions</b> there may be. The full name for one of the <b>someFunctions()</b>is <b>someFunction(int)</b>. As long as this full name is unique, no confusion occurs.</p>\n<p>A typical application may appear as follows:</p>\n<p class=\"article-code\">int intVariable1, intVariable2; // equivalent to<br /> // int Variable1;<br /> // int Variable2;<br />double doubleVariable;<br />// functions are distinguished by the type of<br />// the argument passed<br />someFunction(); // calls someFunction(void)<br />someFunction(intVariable1); // calls someFunction(int)<br />someFunction(doubleVariable); // calls someFunction(double)<br />someFunction(intVariable1, intVariable2); // calls <br /> // someFunction(int, int)<br />// this works for constants as well<br />someFunction(1); // calls someFunction(int)<br />someFunction(1.0); // calls someFunction(double)<br />someFunction(1, 2); // calls someFunction(int, int)</p>\n<p>In each case, the type of the arguments matches the full name of the three functions.</p>\n<p class=\"Warning\">The return type is not part of the extended name (also known as the <i>function signature</i>) of the function. The following two functions have the same name and, thus, cannot be part of the same program:</p>\n<p class=\"article-code\">int someFunction(int n); // full name of the function <br /> // is someFunction(int)<br />double someFunction(int n); // same name</p>\n<p class=\"Remember\">The following is acceptable:</p>\n<p class=\"article-code\">int someFunction(int n);<br />double d = someFunction(10); // promote returned value</p>\n<p>The <b>int</b> returned by <b>someFunction()</b> is promoted into a <b>double.</b> Thus, the following would be confusing:</p>\n<p class=\"article-code\">int someFunction(int n);<br />double someFunction(int n);<br />double d = someFunction(10);// promote returned int?<br /> // or use returned double as is</p>\n<p>C++ would know whether to use the value returned from the <b>double</b> version of <b>someFunction()</b> or promote the value returned from <b>int</b> version.</p>\n<h2 id=\"tab2\" >Defining function prototypes</h2>\n<p>The programmer may provide the remainder of a C++ source file, or module, the extended name (the name and functions) during the definition of the function. </p>\n<p>A function may be defined anywhere in the module. (A <i>module</i> is another name for a C++ source file.) However, something has to tell <b>main()</b> the full name of the function before it can be called. Consider the following code snippet:</p>\n<p class=\"article-code\">int main(int argc, char* pArgs[])<br />{<br /> someFunc(1, 2);<br />}<br />int someFunc(double arg1, int arg2)<br />{<br /> // ...do something<br />}</p>\n<p>The call to <b>someFunc()</b> from within <b>main()</b> doesn't know the full name of the function. It may surmise from the arguments that the name is <b>someFunc(int, int)</b> and that its return type is void; however, as you can see, this is incorrect.</p>\n<p>C++ could be less lazy and look ahead to determine the full name of <b>someFunc()</b>s on its own, but it doesn't. What is needed is some way to inform <b>main()</b> of the full name of <b>someFunc()</b> before it is used. What is needed is a before use function declaration. Some type of prototype is necessary.</p>\n<p>A <i>prototype declaration</i> appears the same as a function with no body. In use, a prototype declaration appears as follows:</p>\n<p class=\"article-code\">int someFunc(double, int);<br />int main(int argc, char* pArgs[])<br />{<br /> someFunc(1, 2);<br />}<br />int someFunc(double arg1, int arg2)<br />{<br /> // ...do something<br />}</p>\n<p>The prototype declaration tells the world (at least that part of the world after the declaration), that the extended name for <b>someFunc()</b> is <b>someFunction(double, int). </b>The call in <b>main()</b> now knows to cast the 1 to a double before making the call. In addition, <b>main()</b> knows that the value returned by <b>someFunc()</b> is an <b>int</b>.</p>\n<p class=\"Tip\">A function call that returns a value is an <i>expression.</i> As with any other provide expression, you are allowed to throw the value returned by a function.</p>\n<h2 id=\"tab3\" >Variable storage types</h2>\n<p>Function variables are stored in three different places. Variables declared within a function are said to be local. In the following example, the variable <b>localVariable</b> is local to the function <b>fn()</b>:</p>\n<p class=\"article-code\">int globalVariable;<br />void fn()<br />{<br /> int localVariable;<br /> static int staticVariable;<br />}</p>\n<p>The variable <b>localVariable</b> doesn't exist until the function <b>fn()</b> is called. <b>localVariable</b> ceases to exist when the function returns. Upon return, whatever value that is stored in <b>localVariable</b> is lost. In addition, only <b>fn()</b> has access to <b>localVariable</b> — other functions cannot reach into the function to access it.</p>\n<p>By comparison, the variable <b>globalVariable</b> exists as long as the program is running. All functions have access to <b>globalVariable</b> all of the time.</p>\n<p>The static variable <b>staticVariable</b> is something of a mix between a local and a global variable. The variable <b>staticVariable</b> is created when execution first reaches the declaration (roughly, when the function <b>fn()</b> is called). In addition, <b>staticVariable</b> is only accessible within <b>fn()</b>. Unlike <b>localVariable</b>, however, <b>staticVariable</b> continues to exist even after the program returns from <b>fn()</b>. If <b>fn()</b> assigns a value to <b>staticVariable</b> once, it will still be there the next time that <b>fn()</b> is called.</p>\n<p>In case anyone asks, there is a fourth type, <b>auto</b>, but today it has the same meaning as <b>local,</b> so just ignore them.</p>","blurb":"","authors":[],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[{"label":"Overloading function names","target":"#tab1"},{"label":"Defining function prototypes","target":"#tab2"},{"label":"Variable storage types","target":"#tab3"}],"relatedArticles":{"fromBook":[],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":0,"slug":null,"isbn":null,"categoryList":null,"amazon":null,"image":null,"title":null,"testBankPinActivationLink":null,"bookOutOfPrint":false,"authorsInfo":null,"authors":null,"_links":null},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[null]}]\" id=\"du-slot-6322195309468\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[null]}]\" id=\"du-slot-6322195309d1e\"></div></div>"},"articleType":{"articleType":"Articles","articleList":null,"content":null,"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":198783},{"headers":{"creationTime":"2016-03-26T22:09:25+00:00","modifiedTime":"2016-03-26T22:09:25+00:00","timestamp":"2022-09-14T18:11:02+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"C++ Syntax that You May Have Forgotten","strippedTitle":"c++ syntax that you may have forgotten","slug":"c-syntax-that-you-may-have-forgotten","canonicalUrl":"","seo":{"metaDescription":"Remembering a bunch of C++ syntax can make you \"loopy.\" The following samples show the syntax of some of the more easily forgotten C++ situations: a for loop, a","noIndex":0,"noFollow":0},"content":"<p>Remembering a bunch of C++ syntax can make you \"loopy.\" The following samples show the syntax of some of the more easily forgotten C++ situations: a <span class=\"code\">for</span> loop, a <span class=\"code\">while</span> loop, and a <span class=\"code\">switch</span> statement; a class and the code for a member function; a base class and a derived class; a function, function pointer type, and pointer to the function; and a class template and then a class based on the template.</p>\n<p>Here’s a <span class=\"code\">for</span> loop:</p>\n<pre class=\"code\">int i;\nfor (i=0; i&lt;10; i++) {\n cout &lt;&lt; i &lt;&lt; endl;\n}</pre>\n<p>Here’s a <span class=\"code\">while</span> loop that counts from 10 down to 1:</p>\n<pre class=\"code\">int i = 10;\nwhile (i &gt; 0) {\n cout &lt;&lt; i &lt;&lt; endl;\n i—;\n}</pre>\n<p>And here’s a <span class=\"code\">switch</span> statement:</p>\n<pre class=\"code\">switch (x) {\ncase 1:\n cout &lt;&lt; “1” &lt;&lt; endl;\ncase 2:\n cout &lt;&lt; “2” &lt;&lt; endl;\ndefault:\n cout &lt;&lt; “Something else” &lt;&lt; endl;\n}</pre>\n<p>Here’s a class and the code for a member function:</p>\n<pre class=\"code\">class MyClass {\nprivate:\n int x;\npublic:\n void MyFunction(int y);\n};\nvoid MyClass::MyFunction(int y) {\n x = y;\n}</pre>\n<p>Here’s a base class and a derived class:</p>\n<pre class=\"code\">class MyBase {\nprivate:\n // derived classes can\n // not access this\n int a; \nprotected:\n // derived classes can \n // access this\n int b; \n};\nclass Derived : public MyBase {\npublic:\n void test() {\n b = 10;\n }\n};</pre>\n<p>Here’s a function, a function pointer type, and a pointer to the function:</p>\n<pre class=\"code\">int function(char x) {\n return (int)x;\n}\ntypedef int (* funcptr)(char);\nfuncptr MyPtr = function;</pre>\n<p>And here’s a class template and then a class based on the template:</p>\n<pre class=\"code\">template &lt;typename T&gt;\nclass MyTemplate {\npublic:\n T a;\n};\nMyTemplate&lt;int&gt; X;</pre>","description":"<p>Remembering a bunch of C++ syntax can make you \"loopy.\" The following samples show the syntax of some of the more easily forgotten C++ situations: a <span class=\"code\">for</span> loop, a <span class=\"code\">while</span> loop, and a <span class=\"code\">switch</span> statement; a class and the code for a member function; a base class and a derived class; a function, function pointer type, and pointer to the function; and a class template and then a class based on the template.</p>\n<p>Here’s a <span class=\"code\">for</span> loop:</p>\n<pre class=\"code\">int i;\nfor (i=0; i&lt;10; i++) {\n cout &lt;&lt; i &lt;&lt; endl;\n}</pre>\n<p>Here’s a <span class=\"code\">while</span> loop that counts from 10 down to 1:</p>\n<pre class=\"code\">int i = 10;\nwhile (i &gt; 0) {\n cout &lt;&lt; i &lt;&lt; endl;\n i—;\n}</pre>\n<p>And here’s a <span class=\"code\">switch</span> statement:</p>\n<pre class=\"code\">switch (x) {\ncase 1:\n cout &lt;&lt; “1” &lt;&lt; endl;\ncase 2:\n cout &lt;&lt; “2” &lt;&lt; endl;\ndefault:\n cout &lt;&lt; “Something else” &lt;&lt; endl;\n}</pre>\n<p>Here’s a class and the code for a member function:</p>\n<pre class=\"code\">class MyClass {\nprivate:\n int x;\npublic:\n void MyFunction(int y);\n};\nvoid MyClass::MyFunction(int y) {\n x = y;\n}</pre>\n<p>Here’s a base class and a derived class:</p>\n<pre class=\"code\">class MyBase {\nprivate:\n // derived classes can\n // not access this\n int a; \nprotected:\n // derived classes can \n // access this\n int b; \n};\nclass Derived : public MyBase {\npublic:\n void test() {\n b = 10;\n }\n};</pre>\n<p>Here’s a function, a function pointer type, and a pointer to the function:</p>\n<pre class=\"code\">int function(char x) {\n return (int)x;\n}\ntypedef int (* funcptr)(char);\nfuncptr MyPtr = function;</pre>\n<p>And here’s a class template and then a class based on the template:</p>\n<pre class=\"code\">template &lt;typename T&gt;\nclass MyTemplate {\npublic:\n T a;\n};\nMyTemplate&lt;int&gt; X;</pre>","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}},{"authorId":9343,"name":"Jeff Cogswell","slug":"jeff-cogswell","description":"Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9343"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":196543,"title":"The 10 Most Common C++ Mistakes","slug":"the-10-most-common-c-mistakes","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196543"}}],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-632219363f349\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-632219363fbe7\"></div></div>"},"articleType":{"articleType":"Articles","articleList":null,"content":null,"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":196545},{"headers":{"creationTime":"2016-03-26T22:09:24+00:00","modifiedTime":"2016-03-26T22:09:24+00:00","timestamp":"2022-09-14T18:11:02+00:00"},"data":{"breadcrumbs":[{"name":"Technology","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33512"},"slug":"technology","categoryId":33512},{"name":"Programming & Web Design","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33592"},"slug":"programming-web-design","categoryId":33592},{"name":"C++","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"},"slug":"cplusplus","categoryId":33597}],"title":"The Usual C++ Header Files","strippedTitle":"the usual c++ header files","slug":"the-usual-c-header-files","canonicalUrl":"","seo":{"metaDescription":"In C++, a header file holds forward declarations of identifiers. Here are some of the most common C++ header files that you’ll be using, along with their correc","noIndex":0,"noFollow":0},"content":"<p>In C++, a header file holds forward declarations of identifiers. Here are some of the most common C++ header files that you’ll be using, along with their correct spellings. These aren’t by any means all of them, but they are the most common:</p>\n<ul class=\"level-one\">\n <li><p class=\"first-para\">Include <span class=\"code\"><string></span> if you’re going to be using the string class.</p>\n </li>\n <li><p class=\"first-para\">Include <span class=\"code\"><iostream></span> when you want to use <span class=\"code\">cout</span> and <span class=\"code\">cin</span>.</p>\n </li>\n <li><p class=\"first-para\">Include <span class=\"code\"><fstream></span> when you want to read or write files.</p>\n </li>\n <li><p class=\"first-para\">Include <span class=\"code\"><iomanip></span> if you want advanced manipulator usage in your streams.</p>\n </li>\n <li><p class=\"first-para\">Include<span class=\"code\"> <stdlib.h></span> for general operations, including <span class=\"code\">system(“PAUSE”)</span>.</p>\n </li>\n</ul>","description":"<p>In C++, a header file holds forward declarations of identifiers. Here are some of the most common C++ header files that you’ll be using, along with their correct spellings. These aren’t by any means all of them, but they are the most common:</p>\n<ul class=\"level-one\">\n <li><p class=\"first-para\">Include <span class=\"code\"><string></span> if you’re going to be using the string class.</p>\n </li>\n <li><p class=\"first-para\">Include <span class=\"code\"><iostream></span> when you want to use <span class=\"code\">cout</span> and <span class=\"code\">cin</span>.</p>\n </li>\n <li><p class=\"first-para\">Include <span class=\"code\"><fstream></span> when you want to read or write files.</p>\n </li>\n <li><p class=\"first-para\">Include <span class=\"code\"><iomanip></span> if you want advanced manipulator usage in your streams.</p>\n </li>\n <li><p class=\"first-para\">Include<span class=\"code\"> <stdlib.h></span> for general operations, including <span class=\"code\">system(“PAUSE”)</span>.</p>\n </li>\n</ul>","blurb":"","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}},{"authorId":9343,"name":"Jeff Cogswell","slug":"jeff-cogswell","description":"Jeff Cogswell has been an application developer and trainer for 18 years, working with clients from startups to Fortune 500 companies. He has developed courses on C++ and other technologies.","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9343"}}],"primaryCategoryTaxonomy":{"categoryId":33597,"title":"C++","slug":"cplusplus","_links":{"self":"https://dummies-api.dummies.com/v2/categories/33597"}},"secondaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"tertiaryCategoryTaxonomy":{"categoryId":0,"title":null,"slug":null,"_links":null},"trendingArticles":[{"articleId":192609,"title":"How to Pray the Rosary: A Comprehensive Guide","slug":"how-to-pray-the-rosary","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/192609"}},{"articleId":208741,"title":"Kabbalah For Dummies Cheat Sheet","slug":"kabbalah-for-dummies-cheat-sheet","categoryList":["body-mind-spirit","religion-spirituality","kabbalah"],"_links":{"self":"/articles/208741"}},{"articleId":230957,"title":"Nikon D3400 For Dummies Cheat Sheet","slug":"nikon-d3400-dummies-cheat-sheet","categoryList":["home-auto-hobbies","photography"],"_links":{"self":"/articles/230957"}},{"articleId":235851,"title":"Praying the Rosary and Meditating on the Mysteries","slug":"praying-rosary-meditating-mysteries","categoryList":["body-mind-spirit","religion-spirituality","christianity","catholicism"],"_links":{"self":"/articles/235851"}},{"articleId":284787,"title":"What Your Society Says About You","slug":"what-your-society-says-about-you","categoryList":["academics-the-arts","humanities"],"_links":{"self":"/articles/284787"}}],"inThisArticle":[],"relatedArticles":{"fromBook":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":196545,"title":"C++ Syntax that You May Have Forgotten","slug":"c-syntax-that-you-may-have-forgotten","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/196545"}}],"fromCategory":[{"articleId":209511,"title":"C++ All-in-One For Dummies Cheat Sheet","slug":"c-all-in-one-for-dummies-cheat-sheet","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/209511"}},{"articleId":203477,"title":"How to Create a Library Project in C++","slug":"how-to-create-a-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203477"}},{"articleId":203476,"title":"How to Configure the Library Project in C++","slug":"how-to-configure-the-library-project-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203476"}},{"articleId":203475,"title":"How to Add the RegEx Library in C++","slug":"how-to-add-the-regex-library-in-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/203475"}},{"articleId":201132,"title":"An Introduction to C++","slug":"an-introduction-to-c","categoryList":["technology","programming-web-design","cplusplus"],"_links":{"self":"https://dummies-api.dummies.com/v2/articles/201132"}}]},"hasRelatedBookFromSearch":false,"relatedBook":{"bookId":281650,"slug":"cplusplus-all-in-one-for-dummies","isbn":"9781119601746","categoryList":["technology","programming-web-design","cplusplus"],"amazon":{"default":"https://www.amazon.com/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","ca":"https://www.amazon.ca/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","indigo_ca":"http://www.tkqlhce.com/click-9208661-13710633?url=https://www.chapters.indigo.ca/en-ca/books/product/1119601746-item.html&cjsku=978111945484","gb":"https://www.amazon.co.uk/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20","de":"https://www.amazon.de/gp/product/1119601746/ref=as_li_tl?ie=UTF8&tag=wiley01-20"},"image":{"src":"https://www.dummies.com/wp-content/uploads/c-plusplus-all-in-one-for-dummies-4th-edition-cover-9781119601746-203x255.jpg","width":203,"height":255},"title":"C++ All-in-One For Dummies","testBankPinActivationLink":"","bookOutOfPrint":true,"authorsInfo":"<p><p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques.</p>","authors":[{"authorId":9109,"name":"John Paul Mueller","slug":"john-paul-mueller","description":" <p><b>John Mueller</b> has produced 114 books and more than 600 articles on topics ranging from functional programming techniques to working with Amazon Web Services &#40;AWS&#41;. <b>Luca Massaron,</b> a Google Developer Expert &#40;GDE&#41;,??interprets big data and transforms it into smart data through simple and effective data mining and machine learning techniques. ","hasArticle":false,"_links":{"self":"https://dummies-api.dummies.com/v2/authors/9109"}}],"_links":{"self":"https://dummies-api.dummies.com/v2/books/"}},"collections":[],"articleAds":{"footerAd":"<div class=\"du-ad-region row\" id=\"article_page_adhesion_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_adhesion_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-632219362fb8a\"></div></div>","rightAd":"<div class=\"du-ad-region row\" id=\"article_page_right_ad\"><div class=\"du-ad-unit col-md-12\" data-slot-id=\"article_page_right_ad\" data-refreshed=\"false\" \r\n data-target = \"[{&quot;key&quot;:&quot;cat&quot;,&quot;values&quot;:[&quot;technology&quot;,&quot;programming-web-design&quot;,&quot;cplusplus&quot;]},{&quot;key&quot;:&quot;isbn&quot;,&quot;values&quot;:[&quot;9781119601746&quot;]}]\" id=\"du-slot-632219363043b\"></div></div>"},"articleType":{"articleType":"Articles","articleList":null,"content":null,"videoInfo":{"videoId":null,"name":null,"accountId":null,"playerId":null,"thumbnailUrl":null,"description":null,"uploadDate":null}},"sponsorship":{"sponsorshipPage":false,"backgroundImage":{"src":null,"width":0,"height":0},"brandingLine":"","brandingLink":"","brandingLogo":{"src":null,"width":0,"height":0},"sponsorAd":"","sponsorEbookTitle":"","sponsorEbookLink":"","sponsorEbookImage":{"src":null,"width":0,"height":0}},"primaryLearningPath":"Advance","lifeExpectancy":null,"lifeExpectancySetFrom":null,"dummiesForKids":"no","sponsoredContent":"no","adInfo":"","adPairKey":[]},"status":"publish","visibility":"public","articleId":196544}],"_links":{"self":{"self":"https://dummies-api.dummies.com/v2/categories/33597/categoryArticles?sortField=time&sortOrder=1&size=10&offset=0"},"next":{"self":"https://dummies-api.dummies.com/v2/categories/33597/categoryArticles?sortField=time&sortOrder=1&size=10&offset=10"},"last":{"self":"https://dummies-api.dummies.com/v2/categories/33597/categoryArticles?sortField=time&sortOrder=1&size=10&offset=53"}}},"objectTitle":"","status":"success","pageType":"article-category","objectId":"33597","page":1,"sortField":"time","sortOrder":1,"categoriesIds":[],"articleTypes":[],"filterData":{"categoriesFilter":[{"itemId":0,"itemName":"All Categories","count":63}],"articleTypeFilter":[{"articleType":"All Types","count":63},{"articleType":"Articles","count":59},{"articleType":"Cheat Sheet","count":1},{"articleType":"Step by Step","count":3}]},"filterDataLoadedStatus":"success","pageSize":10},"adsState":{"pageScripts":{"headers":{"timestamp":"2025-04-17T15:50:01+00:00"},"adsId":0,"data":{"scripts":[{"pages":["all"],"location":"header","script":"<!--Optimizely Script-->\r\n<script src=\"https://cdn.optimizely.com/js/10563184655.js\"></script>","enabled":false},{"pages":["all"],"location":"header","script":"<!-- comScore Tag -->\r\n<script>var _comscore = _comscore || [];_comscore.push({ c1: \"2\", c2: \"15097263\" });(function() {var s = document.createElement(\"script\"), el = document.getElementsByTagName(\"script\")[0]; s.async = true;s.src = (document.location.protocol == \"https:\" ? \"https://sb\" : \"http://b\") + \".scorecardresearch.com/beacon.js\";el.parentNode.insertBefore(s, el);})();</script><noscript><img src=\"https://sb.scorecardresearch.com/p?c1=2&c2=15097263&cv=2.0&cj=1\" /></noscript>\r\n<!-- / comScore Tag -->","enabled":true},{"pages":["all"],"location":"footer","script":"<!--BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET-->\r\n<script type='text/javascript'>\r\n(function(){var g=function(e,h,f,g){\r\nthis.get=function(a){for(var a=a+\"=\",c=document.cookie.split(\";\"),b=0,e=c.length;b<e;b++){for(var d=c[b];\" \"==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};\r\nthis.set=function(a,c){var b=\"\",b=new Date;b.setTime(b.getTime()+6048E5);b=\"; expires=\"+b.toGMTString();document.cookie=a+\"=\"+c+b+\"; path=/; \"};\r\nthis.check=function(){var a=this.get(f);if(a)a=a.split(\":\");else if(100!=e)\"v\"==h&&(e=Math.random()>=e/100?0:100),a=[h,e,0],this.set(f,a.join(\":\"));else return!0;var c=a[1];if(100==c)return!0;switch(a[0]){case \"v\":return!1;case \"r\":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(\":\")),!c}return!0};\r\nthis.go=function(){if(this.check()){var a=document.createElement(\"script\");a.type=\"text/javascript\";a.src=g;document.body&&document.body.appendChild(a)}};\r\nthis.start=function(){var t=this;\"complete\"!==document.readyState?window.addEventListener?window.addEventListener(\"load\",function(){t.go()},!1):window.attachEvent&&window.attachEvent(\"onload\",function(){t.go()}):t.go()};};\r\ntry{(new g(100,\"r\",\"QSI_S_ZN_5o5yqpvMVjgDOuN\",\"https://zn5o5yqpvmvjgdoun-wiley.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_5o5yqpvMVjgDOuN\")).start()}catch(i){}})();\r\n</script><div id='ZN_5o5yqpvMVjgDOuN'><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>\r\n<!--END WEBSITE FEEDBACK SNIPPET-->","enabled":false},{"pages":["all"],"location":"header","script":"<!-- Hotjar Tracking Code for http://www.dummies.com -->\r\n<script>\r\n (function(h,o,t,j,a,r){\r\n h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\r\n h._hjSettings={hjid:257151,hjsv:6};\r\n a=o.getElementsByTagName('head')[0];\r\n r=o.createElement('script');r.async=1;\r\n r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\r\n a.appendChild(r);\r\n })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\r\n</script>","enabled":false},{"pages":["article"],"location":"header","script":"<!-- //Connect Container: dummies --> <script src=\"//get.s-onetag.com/bffe21a1-6bb8-4928-9449-7beadb468dae/tag.min.js\" async defer></script>","enabled":true},{"pages":["homepage"],"location":"header","script":"<meta name=\"facebook-domain-verification\" content=\"irk8y0irxf718trg3uwwuexg6xpva0\" />","enabled":true},{"pages":["homepage","article","category","search"],"location":"footer","script":"<!-- Facebook Pixel Code -->\r\n<noscript>\r\n<img height=\"1\" width=\"1\" src=\"https://www.facebook.com/tr?id=256338321977984&ev=PageView&noscript=1\"/>\r\n</noscript>\r\n<!-- End Facebook Pixel Code -->","enabled":true}]}},"pageScriptsLoadedStatus":"success"},"navigationState":{"navigationCollections":[{"collectionId":287568,"title":"BYOB (Be Your Own Boss)","hasSubCategories":false,"url":"/collection/for-the-entry-level-entrepreneur-287568"},{"collectionId":293237,"title":"Be a Rad Dad","hasSubCategories":false,"url":"/collection/be-the-best-dad-293237"},{"collectionId":295890,"title":"Career Shifting","hasSubCategories":false,"url":"/collection/career-shifting-295890"},{"collectionId":294090,"title":"Contemplating the Cosmos","hasSubCategories":false,"url":"/collection/theres-something-about-space-294090"},{"collectionId":287563,"title":"For Those Seeking Peace of Mind","hasSubCategories":false,"url":"/collection/for-those-seeking-peace-of-mind-287563"},{"collectionId":287570,"title":"For the Aspiring Aficionado","hasSubCategories":false,"url":"/collection/for-the-bougielicious-287570"},{"collectionId":291903,"title":"For the Budding Cannabis Enthusiast","hasSubCategories":false,"url":"/collection/for-the-budding-cannabis-enthusiast-291903"},{"collectionId":299891,"title":"For the College Bound","hasSubCategories":false,"url":"/collection/for-the-college-bound-299891"},{"collectionId":291934,"title":"For the Exam-Season Crammer","hasSubCategories":false,"url":"/collection/for-the-exam-season-crammer-291934"},{"collectionId":301547,"title":"For the Game Day Prepper","hasSubCategories":false,"url":"/collection/big-game-day-prep-made-easy-301547"}],"navigationCollectionsLoadedStatus":"success","navigationCategories":{"books":{"0":{"data":[{"categoryId":33512,"title":"Technology","hasSubCategories":true,"url":"/category/books/technology-33512"},{"categoryId":33662,"title":"Academics & The Arts","hasSubCategories":true,"url":"/category/books/academics-the-arts-33662"},{"categoryId":33809,"title":"Home, Auto, & Hobbies","hasSubCategories":true,"url":"/category/books/home-auto-hobbies-33809"},{"categoryId":34038,"title":"Body, Mind, & Spirit","hasSubCategories":true,"url":"/category/books/body-mind-spirit-34038"},{"categoryId":34224,"title":"Business, Careers, & Money","hasSubCategories":true,"url":"/category/books/business-careers-money-34224"}],"breadcrumbs":[],"categoryTitle":"Level 0 Category","mainCategoryUrl":"/category/books/level-0-category-0"}},"articles":{"0":{"data":[{"categoryId":33512,"title":"Technology","hasSubCategories":true,"url":"/category/articles/technology-33512"},{"categoryId":33662,"title":"Academics & The Arts","hasSubCategories":true,"url":"/category/articles/academics-the-arts-33662"},{"categoryId":33809,"title":"Home, Auto, & Hobbies","hasSubCategories":true,"url":"/category/articles/home-auto-hobbies-33809"},{"categoryId":34038,"title":"Body, Mind, & Spirit","hasSubCategories":true,"url":"/category/articles/body-mind-spirit-34038"},{"categoryId":34224,"title":"Business, Careers, & Money","hasSubCategories":true,"url":"/category/articles/business-careers-money-34224"}],"breadcrumbs":[],"categoryTitle":"Level 0 Category","mainCategoryUrl":"/category/articles/level-0-category-0"}}},"navigationCategoriesLoadedStatus":"success"},"searchState":{"searchList":[],"searchStatus":"initial","relatedArticlesList":[],"relatedArticlesStatus":"initial"},"routeState":{"name":"ArticleCategory","path":"/category/articles/cplusplus-33597/","hash":"","query":{},"params":{"category":"cplusplus-33597"},"fullPath":"/category/articles/cplusplus-33597/","meta":{"routeType":"category","breadcrumbInfo":{"suffix":"Articles","baseRoute":"/category/articles"},"prerenderWithAsyncData":true},"from":{"name":null,"path":"/","hash":"","query":{},"params":{},"fullPath":"/","meta":{}}},"profileState":{"auth":{},"userOptions":{},"status":"success"}}
Logo
  • Articles Open Article Categories
  • Books Open Book Categories
  • Collections Open Collections list
  • Custom Solutions

Article Categories

Book Categories

Collections

Explore all collections
BYOB (Be Your Own Boss)
Be a Rad Dad
Career Shifting
Contemplating the Cosmos
For Those Seeking Peace of Mind
For the Aspiring Aficionado
For the Budding Cannabis Enthusiast
For the College Bound
For the Exam-Season Crammer
For the Game Day Prepper
Log In
  • Home
  • Technology Articles
  • Programming & Web Design Articles
  • C++ Articles

C++ Articles

C++ is a flexible and powerful programming language. Learn the basics, plus some cool tidbits you haven't seen before.

Articles From C++

page 1
page 2
page 3
page 4
page 5
page 6
page 7

Filter Results

63 results
63 results
C++ C++ All-in-One For Dummies Cheat Sheet

Cheat Sheet / Updated 03-19-2021

C++ continues to get better over the years because people just keep contributing to it and finding new ways to work with it. You can find C++ in an amazing array of applications because it works everywhere — from desktop and mobile applications to embedded applications and other types of systems. Because C++ is so incredibly flexible, people keep coming to it as a best solution for many general programming needs and some specific needs as well.

View Cheat Sheet
C++ Attaching to a Running Process Using Code::Blocks

Article / Updated 03-09-2017

Every time you start a new application, you create one or more processes. A process is simply executable code that is loaded into memory. The CPU reads and executes the instructions to perform the tasks you ask the application to do. When the CPU loads your application into memory, it assigns each process the application creates a Process IDentifier (PID), which is pronounced pid (think of lid with a p instead of an l). The PID is simply a number associated with the process for easy identification. In most cases, you debug an application by running it in the IDE in debug mode. However, there are some situations where you must debug the application in a different way — by attaching to its process. Attaching to the process means telling the CPU to send the instructions in the executable code to a debugger before they're executed by the CPU. In other words, you place the debugger between the executable code and the CPU. Here are some of the most common reasons for performing this task: The executable code is behaving differently in the debugger than it does when executed as a regular application. Instead of working with a debug version, you want to debug the release version. It's important to see the disassembled code as it loads in memory. You don't actually have source code to load into the debugger and execute. There are many other reasons to attach to a running process, but these are the most common reasons. Of course, before you can attach to the process, you need to know the PID. Determining the PID depends on the platform you're using. Here are some common approaches: Windows: Look at the Processes tab of the Windows Task Manager Mac OS X: Use the PS utility in the Terminal window or the Activity Monitor Linux: Use the PS utility in the Terminal window Once you have a PID, you can use it to attach to the process in Code::Blocks. The following steps get you started. Open your copy of Code::Blocks using a technique appropriate for your operating system. You see the Code::Blocks IDE open with the Start Here tab opened. Choose Debug→Attach to Process The Input Text dialog box appears. Type the PID in the PID to Attach To field and then click OK. You see the Debugger tab of the Logs and Others window appear. This tab contains information about the current process. You can type commands in the Command field to perform debugging tasks. At this point, you can type commands in the Command field to perform debugging tasks. The most common commands are: Break: Stops application execution so you can examine the application state. Step: Steps one source line (which may be several assembly lines). Continue: Restarts application execution. Go: Continues application execution to a specific point in the code. Detach: Detaches a previously attached PID so that you can safely shut the debugger down. Help: Displays additional command information.

View Article
C++ How to Add the RegEx Library in C++

Step by Step / Updated 06-27-2016

Most of the Boost library works just fine by adding headers to your application code. However, a few components, such as RegEx, require a library. Before you can use a library, you must build it. After you build the library, you must add it to your application. There are two techniques for adding the required headers and libraries to an application. The first technique is to add it to the compiler settings. The second technique is to add the settings to a specific project. You use the first technique when you work with Boost for a large number of projects and require access to all libraries. The second technique is best when you use Boost only for specific projects and require access only to specific libraries. The following steps show you how to perform the project-specific setup for any library, not just the RegEx library:

View Step by Step
C++ How to Configure the Library Project in C++

Step by Step / Updated 06-27-2016

The static library starts with a standard C file. To make this library work well with templates, you need to delete the C file, add a C++ file, and add a header file. The following steps describe how to perform this process:

View Step by Step
C++ How to Create a Library Project in C++

Step by Step / Updated 06-27-2016

Creating a library project in C++ is only a little different than creating a console application. The following steps describe how to create a library project:

View Step by Step
C++ An Introduction to C++

Article / Updated 03-26-2016

The C++ programming language consists of a vocabulary of commands that humans can understand and that can be converted into machine language fairly easily and a language structure (or grammar) that allows humans to combine these C++ commands into a program that actually does something (well, maybe does something) The vocabulary is often known as the semantics, while the grammar is the syntax. What's a program? A C++ program is a text file containing a sequence of C++ commands put together according to the laws of C++ grammar. This text file is known as the source file . A C++ source file carries the extension .CPP just as a Microsoft Word file ends in .DOC or an MS-DOS batch file ends in .BAT. The concept extension .CPP is just a convention, but it's used almost exclusively in the PC world. The point of programming is to write a sequence of C++ commands that can be converted into a machine language program that does whatever it is that you want done. Such machine executable programs carry the extension .EXE. The act of creating an executable program from a C++ program is called compiling (or building — there is a difference, but it's small). How do I program? To write a program, you need two things: an editor to build your .CPP source file with and a program that converts your source file into a machine executable .EXE file to carry out your commands. The tool that does the conversion is known as a compiler. Nowadays, tool developers generally combine the compiler with an editor into a single work-environment package. After entering your program, you need only click a button to create the executable file. The most popular of all C++ environments is Microsoft's Visual C++, but the software is expensive. Fortunately, there are public domain C++ environments — the most popular of which is GNU C++. (Pronounce GNU like this: guh NEW). You can download public domain programs from the Internet. Some of these programs are not free — you are either encouraged to or required to pay some usually small fee. You do not have to pay to use GNU C++. GNU stands for the circular definition "GNU is Not UNIX." This joke goes way back to the early days of C++ — just accept it as is. GNU is a series of tools built by the Free Software Foundation. GNU C++ is not some bug-ridden, limited edition C++ compiler from some fly-by-night group of developers. GNU C++ is a full-fledged C++ environment. GNU C++ supports the entire C++ language and executes all C++ programs. GNU C++ is not a Windows development package for the Windows environment. You'll have to break open the wallet and go for a commercial package like Visual C++.

View Article
C++ Expressing Binary Numbers in C++

Article / Updated 03-26-2016

C++ variables are stored internally as so-called binary numbers. Binary numbers are stored as a sequence of 1 and 0 values known as bits. Most of the time, you don't really need to deal with numbers at the bit level; however, there are occasions when doing so is convenient. C++ provides a set of operators for this purpose. The so-called bitwise logical operators operate on their arguments at the bit level. To understand how they work, examine how computers store variables. The decimal number system The numbers that you are familiar with are known as decimal numbers because they are based on the number 10. In general, the programmer expresses C++ variables as decimal numbers. Thus, you would say that the value of var is 123, for example. A number such as 123 refers to 1 * 100 + 2 * 10 + 3 * 1. Each of these base numbers — 100, 10, and 1 — is a power of 10. 123 = 1 * 100 + 2 * 10 + 3 * 1 Expressed in a slightly different but equivalent way: 123 = 1 * 102 + 2 * 101 + 3 * 100 Remember that any number to the zero power is 1. Other number systems The use of a base number of 10 for the counting system stems, in all probability, from the fact that humans have 10 fingers, the original counting tools. The alternative would have been base 20. If dogs had invented our numbering scheme, it may well have been based on the numeral 8 (one digit of each paw is out of sight on the back part of the leg). Such an octal system would have worked just as well: 12310 = 1 * 82 + 7 * 81 + 3 * 80 = 1738 The small 10 and 8 here refer to the numbering system, 10 for decimal (base 10) and 8 for octal (base 8). A counting system may use any positive base. The binary number system Computers have essentially two fingers. (Maybe that's why computers are so stupid: Without an opposable thumb, they can't grasp anything. And then again, maybe not.) Computers prefer counting using base 2. The number 12310 would be expressed as: 12310 = 0*128 + 1*64 + 1*32 + 1*16 + 1*8 + 0*4 +1*2 + 1*1 = 011110112 It is always convention to express binary numbers by using 4, 8, 32, or 64 binary digits even if the leading digits are zero. This is also because of the way computers are built internally. Because the term digit refers to a multiple of ten, a binary digit is called a bit. The term stems from binary (b-) digit (-it). Eight bits make up a byte. A word is usually either two or four bytes. With such a small base, it is necessary to use a large number of bits to express numbers. It is inconvenient to use an expression such as 011110112 to express such a mundane value as 12310. Programmers prefer to express numbers by units of bytes, or eight bits. A single, four-bit digit is essentially base 16, because four bits can express up to any value from 0 to 15. Base 16 is known as the hexadecimal counting system. Hexadecimal is often contracted to simply hex. Hexadecimal uses the same digits for the numbers 0 through 9. For the digits between 9 and 16, hexadecimal uses the first six letters of the alphabet: A for 10, B for 11, and so on. Thus, 12310 becomes 7B16. 123 = 7 * 161 + B (i.e., 11) * 160 = 7B16 Because programmers prefer to express numbers in 4, 8, 32, or 64 bits, they similarly prefer to express hexadecimal numbers in 1, 2, 4, or 8 hexadecimal digits even when the leading digits are 0. Finally, it is inconvenient to express a hexadecimal number such as 7B16 using a subscript, because terminals don't support subscripts. Even on a word processor, it is inconvenient to change fonts to and from subscript mode just to type two digits. Therefore, programmers use the convention of beginning a hexadecimal number with a 0x (the reason for such a strange conviction goes back to the early days of C). Thus, 7B becomes 0x7B. Using this convention, 0x7B is equal to 123 (while 0x123 is equal to 291.) All of the mathematical operators can be performed on hexadecimal numbers in the same way that they are applied to decimal numbers. The reason that we can't perform a multiplication such as 0xC * 0xE in our heads has more to do with the multiplication tables we learned in school than on any limitation in the number system.

View Article
C++ Working with Functions in C++

Article / Updated 03-26-2016

Developers often need the ability to break programs up into smaller chunks that are easier to develop. "Real world" programs can be many of thousands (or millions!) of lines long. Without this ability to divide the program into parts, developing such large programs would quickly become impossible. C++ allows programmers to divide their code up into chunks known as functions. A function with a simple description and a well-defined interface to the outside world can be written and debugged without worrying about the code that surrounds it. Overloading function names C++ allows the programmer to assign the same name to two or more functions. This multiple use of names is known as overloading functions or, simply, overloading. In general, two functions in a single program cannot share the same name. If they did, C++ would have no way to distinguish them. However, the name of the function includes the number and type of its arguments. (The name of the function does not include its return argument.) Thus, the following are not the same functions: void someFunction(void){ // ....perform some function}void someFunction(int n){ // ...perform some different function}void someFunction(double d){ // ...perform some very different function}void someFunction(int n1, int n2){ // ....do something different yet} C++ still knows that the functions someFunction(void), someFunction(int), someFunction(double), and someFunction(int, int) are not the same. Like so many things that deal with computers, this has an analogy in the human world. void as an argument type is optional. sumFunction(void) and sumFunction() are the same function. A function has a shorthand name, such as someFunction(). As long as we use the entire name, no one gets confused — no matter how many someFunctions there may be. The full name for one of the someFunctions()is someFunction(int). As long as this full name is unique, no confusion occurs. A typical application may appear as follows: int intVariable1, intVariable2; // equivalent to // int Variable1; // int Variable2;double doubleVariable;// functions are distinguished by the type of// the argument passedsomeFunction(); // calls someFunction(void)someFunction(intVariable1); // calls someFunction(int)someFunction(doubleVariable); // calls someFunction(double)someFunction(intVariable1, intVariable2); // calls // someFunction(int, int)// this works for constants as wellsomeFunction(1); // calls someFunction(int)someFunction(1.0); // calls someFunction(double)someFunction(1, 2); // calls someFunction(int, int) In each case, the type of the arguments matches the full name of the three functions. The return type is not part of the extended name (also known as the function signature) of the function. The following two functions have the same name and, thus, cannot be part of the same program: int someFunction(int n); // full name of the function // is someFunction(int)double someFunction(int n); // same name The following is acceptable: int someFunction(int n);double d = someFunction(10); // promote returned value The int returned by someFunction() is promoted into a double. Thus, the following would be confusing: int someFunction(int n);double someFunction(int n);double d = someFunction(10);// promote returned int? // or use returned double as is C++ would know whether to use the value returned from the double version of someFunction() or promote the value returned from int version. Defining function prototypes The programmer may provide the remainder of a C++ source file, or module, the extended name (the name and functions) during the definition of the function. A function may be defined anywhere in the module. (A module is another name for a C++ source file.) However, something has to tell main() the full name of the function before it can be called. Consider the following code snippet: int main(int argc, char* pArgs[]){ someFunc(1, 2);}int someFunc(double arg1, int arg2){ // ...do something} The call to someFunc() from within main() doesn't know the full name of the function. It may surmise from the arguments that the name is someFunc(int, int) and that its return type is void; however, as you can see, this is incorrect. C++ could be less lazy and look ahead to determine the full name of someFunc()s on its own, but it doesn't. What is needed is some way to inform main() of the full name of someFunc() before it is used. What is needed is a before use function declaration. Some type of prototype is necessary. A prototype declaration appears the same as a function with no body. In use, a prototype declaration appears as follows: int someFunc(double, int);int main(int argc, char* pArgs[]){ someFunc(1, 2);}int someFunc(double arg1, int arg2){ // ...do something} The prototype declaration tells the world (at least that part of the world after the declaration), that the extended name for someFunc() is someFunction(double, int). The call in main() now knows to cast the 1 to a double before making the call. In addition, main() knows that the value returned by someFunc() is an int. A function call that returns a value is an expression. As with any other provide expression, you are allowed to throw the value returned by a function. Variable storage types Function variables are stored in three different places. Variables declared within a function are said to be local. In the following example, the variable localVariable is local to the function fn(): int globalVariable;void fn(){ int localVariable; static int staticVariable;} The variable localVariable doesn't exist until the function fn() is called. localVariable ceases to exist when the function returns. Upon return, whatever value that is stored in localVariable is lost. In addition, only fn() has access to localVariable — other functions cannot reach into the function to access it. By comparison, the variable globalVariable exists as long as the program is running. All functions have access to globalVariable all of the time. The static variable staticVariable is something of a mix between a local and a global variable. The variable staticVariable is created when execution first reaches the declaration (roughly, when the function fn() is called). In addition, staticVariable is only accessible within fn(). Unlike localVariable, however, staticVariable continues to exist even after the program returns from fn(). If fn() assigns a value to staticVariable once, it will still be there the next time that fn() is called. In case anyone asks, there is a fourth type, auto, but today it has the same meaning as local, so just ignore them.

View Article
C++ C++ Syntax that You May Have Forgotten

Article / Updated 03-26-2016

Remembering a bunch of C++ syntax can make you "loopy." The following samples show the syntax of some of the more easily forgotten C++ situations: a for loop, a while loop, and a switch statement; a class and the code for a member function; a base class and a derived class; a function, function pointer type, and pointer to the function; and a class template and then a class based on the template. Here’s a for loop: int i; for (i=0; i<10; i++) { cout << i << endl; } Here’s a while loop that counts from 10 down to 1: int i = 10; while (i > 0) { cout << i << endl; i—; } And here’s a switch statement: switch (x) { case 1: cout << “1” << endl; case 2: cout << “2” << endl; default: cout << “Something else” << endl; } Here’s a class and the code for a member function: class MyClass { private: int x; public: void MyFunction(int y); }; void MyClass::MyFunction(int y) { x = y; } Here’s a base class and a derived class: class MyBase { private: // derived classes can // not access this int a; protected: // derived classes can // access this int b; }; class Derived : public MyBase { public: void test() { b = 10; } }; Here’s a function, a function pointer type, and a pointer to the function: int function(char x) { return (int)x; } typedef int (* funcptr)(char); funcptr MyPtr = function; And here’s a class template and then a class based on the template: template <typename T> class MyTemplate { public: T a; }; MyTemplate<int> X;

View Article
C++ The Usual C++ Header Files

Article / Updated 03-26-2016

In C++, a header file holds forward declarations of identifiers. Here are some of the most common C++ header files that you’ll be using, along with their correct spellings. These aren’t by any means all of them, but they are the most common: Include if you’re going to be using the string class. Include when you want to use cout and cin. Include when you want to read or write files. Include if you want advanced manipulator usage in your streams. Include for general operations, including system(“PAUSE”).

View Article
page 1
page 2
page 3
page 4
page 5
page 6
page 7

Quick Links

  • About For Dummies
  • Contact Us
  • Activate Online Content

Connect

About Dummies

Dummies has always stood for taking on complex concepts and making them easy to understand. Dummies helps everyone be more knowledgeable and confident in applying what they know. Whether it's to pass that big test, qualify for that big promotion or even master that cooking technique; people who rely on dummies, rely on it to learn the critical skills and relevant information necessary for success.

Copyright @ 2000-2024 by John Wiley & Sons, Inc., or related companies. All rights reserved, including rights for text and data mining and training of artificial technologies or similar technologies.

Terms of Use
Privacy Policy
Cookies Settings
Do Not Sell My Personal Info - CA Only