You can add, subtract, multiply, and divide, here are some basic examples:
Code:
Here are some other shortcuts you can take:
Code:
in conditional statements, there are some other operators:
Code:
I think I covered all of the basics.
Code:
Adding:
int a = 1;
int b = 2;
int c = a + b;
int d = b - a;
int e = b * a; //I'm no expert, but perhaps in calculator C there is a different function for this, as pointers may act weirdly?
int f = b / a;
Here are some other shortcuts you can take:
Code:
int i = 0;
i++; //Increments i by 1
i--; //decrements i by 1
i += 2; // adds 2 to i
i -= 2; // subtracts 2 from i
i = 10; //sets i to 10
i *= 10; //multiplies i by 10
i /= 10; //divides i by 10
in conditional statements, there are some other operators:
Code:
int foo = 1;
if (i == 10 || foo == 2) //if i is equivalent to 10 or foo is equal to two
{
foo = 1; //set foo to 1
}
if (i == 5 && foo == 1) //if i is equal to 10 and foo is equal to one
{
i = 0; // set i to 0
}
if (i == 5 %% foo != 1) //if i is equal to 10 and foo is NOT equal to one
{
foo = 10; // set foo to 10
}
I think I covered all of the basics.