On this mastery I will show you some basic variable types in C++, how and when to use them.\u00a0<\/p>\n
There are several types in C++ but the basic ones are char, int, long, float, <\/b>and double.<\/b><\/p>\n
Each one serves a specific purpose when a variable is used.<\/p>\n
char <\/b>type consists of characters used in a function. It is used when your output will consist of a character or characters. For example, we used it on mastery 19<\/a>\u00a0<\/i><\/b>when our output was a character.<\/p>\n int <\/b>type is the most used and common in C++. We can use it for numbers but not so big ones. We used it on mastery 10<\/a><\/i><\/b> where our output was a simple math operation.<\/p>\n long <\/b>type is similar to int but allows us to have bigger integer number outputs. We used it on mastery 21<\/a><\/i><\/b> where our factorial numbers could get bigger.<\/p>\n float <\/b>and double <\/b>allows us to have non integer number outputs. For example, the division of 3\/2 = 1.5, float <\/b>allows us to have that output and double <\/b>works as long<\/b>, where we can have bigger non-integer number outputs. float <\/b>was used on wsq10 <\/a><\/i><\/b>where a divition could be a non-integer number.<\/p>\n Hope I could clear some doubts and hopefully you know now when to use each type!<\/p>\n","protected":false},"excerpt":{"rendered":" On this mastery I will show you some basic variable types in C++, how and when to use them. <\/p>\n There are several types in C++ but the basic ones are char, int, long, float, <\/b>and double.<\/b><\/p>\n Each one serves a specific purpose when a variable is used.<\/p>\n char <\/b>type consists of characters used in a function. It is used when your output will consist of a character or characters. For example, we used it on mastery 19<\/a> <\/i><\/b>when our output was a character.<\/p>\n int <\/b>type is the most used and common in C++. We can use it for numbers but not so big ones. We used it on mastery 10<\/a><\/i><\/b> where our output was a simple math operation.<\/p>\n long <\/b>type is similar to int but allows us to have bigger integer number outputs. We used it on mastery 21<\/a><\/i><\/b> where our factorial numbers could get bigger.<\/p>\n float <\/b>and double <\/b>allows us to have non integer number outputs. For example, the division of 3\/2 = 1.5, float <\/b>allows us to have that output and double <\/b>works as long<\/b>, where we can have bigger non-integer number outputs. float <\/b>was used on wsq10 <\/a><\/i><\/b>where a divition could be a non-integer number.<\/p>\n Hope I could clear some doubts and hopefully you know now when to use each type!<\/p>\n","protected":false},"author":230,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[219,40,611,372],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25301"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/230"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=25301"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25301\/revisions"}],"predecessor-version":[{"id":25302,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/25301\/revisions\/25302"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=25301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=25301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=25301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}