User Tools

Site Tools


cpp:editing_the_value_of_variables

Differences

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

Link to this comparison view

cpp:editing_the_value_of_variables [2014/02/19 21:00]
jazpen created
cpp:editing_the_value_of_variables [2024/02/16 00:48] (current)
Line 1: Line 1:
 To edit the value of a variable, you use the mathematical operators +, -, /, and *. To edit the value of a variable, you use the mathematical operators +, -, /, and *.
 +Let's create the variable jimmy and set it to nine :
 +
 +
 +''int jimmy = 9;''
 +
 +If we want jimmy to to set to 10 we can do the following:
 +
 +''jimmy = jimmy + 1;''
 +
 +Remember this syntax: [the varaible that you want to change] = [the number or existing varaible] ;
 +
 +So ''jimmy'' is the variable you want to change (to ten) and ''jimmy + 1'' is the value that exists. Merely typing ''jimmy + 1'' does not set the value of jimmy to 10 because to change the value of something, you must have the equal sign. It is used the same way in C++ as in mathematicals.
 +
 +Because typing ''variable = variable + //x//'' is repetitive and annoying, the creator (all hail Bjarne Stroustrup) made
 +
 +<fc #FF0000>Editing in Progress</fc>

on the occasion of the current invasion of Russia in Ukraine

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

Impressum Datenschutz