User Tools

Site Tools


cpp:variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cpp:variables [2014/02/08 00:07]
173.69.2.138
cpp:variables [2024/02/16 00:48] (current)
Line 1: Line 1:
-Variables-+**Variables**
    
 Variables are the means of storing data in a program. Say you want to make a calculator, you need to use variables. Say you want to make a program that takes in a word and then modifies it, you need to use variables. Variables can be created and "destroyed"(deconstructing comes later on so don't get your hopes up). The value or information that they store can be changed and in some cases, that you make it so, cannot be. Except for the syntax of the language, //you// are in control! Variables are the means of storing data in a program. Say you want to make a calculator, you need to use variables. Say you want to make a program that takes in a word and then modifies it, you need to use variables. Variables can be created and "destroyed"(deconstructing comes later on so don't get your hopes up). The value or information that they store can be changed and in some cases, that you make it so, cannot be. Except for the syntax of the language, //you// are in control!
  
 To create a variable: To create a variable:
-<code>+<code cpp>
 //don't worry about things that have a " * " in the comment, we'll get to those //don't worry about things that have a " * " in the comment, we'll get to those
  
Line 28: Line 28:
 This is a list of the most common types of variables: This is a list of the most common types of variables:
  
-<code>+<code cpp>
 bool Stores either value true or false. bool Stores either value true or false.
 char Typically a single octet(one byte). This is an integer type. (one character) char Typically a single octet(one byte). This is an integer type. (one character)
Line 41: Line 41:
  
 Our variable was an "int" or, in Enlish, an integer. Let's make the variable equal to a number. Our variable was an "int" or, in Enlish, an integer. Let's make the variable equal to a number.
-<code>+<code cpp>
 int var1 ; int var1 ;
 var1 = 5 ; var1 = 5 ;
Line 51: Line 51:
  
 Variables can even be equal to each other! Variables can even be equal to each other!
-<code> +<code cpp
-int var1 = ;+int var1 = ;
 int var2 ;    //another integer variable named "var2" int var2 ;    //another integer variable named "var2"
 var2 = var1 ; //the value of var2 is now the same as the value of var1  var2 = var1 ; //the value of var2 is now the same as the value of var1 
 </code> </code>
  
-**Useful Tip**+<fc #FF0000>**Useful Tip**</fc>
 When making a variable equal to something, you must use this syntax: When making a variable equal to something, you must use this syntax:
 [the varaible that you want to change] = [the number or existing varaible] ; [the varaible that you want to change] = [the number or existing varaible] ;

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
cpp/variables.1391814453.txt · Last modified: 2024/02/16 00:47 (external edit)

Impressum Datenschutz