This week we have been learning more of the complexities of C++. We have been learning more about different data types and what they are used for. We learned that the primitive data types are char, int, double, float, and bool. These are the most simple data types and are easiest to use. Int stores an integer; double and float store rational numbers; char stores characters; and bool stores a true or a false. Along with the primitive data types we learned about the if statement. The if statement allows you to check if a statement is true or false. If the statement is true, the code will execute; if the statement is false, the code will not be executed. This allows the computer program to make decisions based on the information that is passed to it. This can also be used to stop errors from occurring such as before dividing checking to see if the denominator is zero. Using the primitive data types and if statements, we have been able to make slightly more complicated programs.
No comments:
Post a Comment