Note that ?= means any number of quesiton marks charecter logic operator equals so ?= means += or -=… In QC there are various binary math operators. Examples are:
| Operator | Usage | Effect |
|---|---|---|
| ’+’ | L + R | Addition |
| ’-‘ | L - R | Subtraction |
| ‘*’ | L * R | Multiplication |
| ’/’ | L / R | Division |
| ‘**’ | L ** R | Power |
| ’%’ | L % R | Modulo |
| ’?=’ | L ?= R | Combinational |
Modulo returns the remainder of a division.
Function syntax will be coverd later, but the boilerplate for Quantum C is simple.
int main() {
// Code Goes Here
}
No includes, no nothing.
Variables in Quantum C are declared as follows:
type name = value;
// OR
type name;
The datatypes are string, char, int, float, double, bool, and qbool, with the modifiers const, long, and short. Example:
int main() {
string StringEx = "This is a string"; // Strings are a list of characters
char CharExNewline = '\n'; // Chard are a single charecter, 4 digit unicode, or escape sequence
bool BoolEx = true; // Booleans are true or false
qbool QboolEx = both; // QBools are qtrue qfalse both or none
int Num = 123456789; // ints are any 32 bit whole number (any number between -2147483648 and 2147483647)
float FloatPi = 3.141592f; // floats are a 32 bit floating point number (7 digits of persision.)
double DoublePi = 3.141592653589793; // doubles are 64 bit floating point numbers (14 digits of persision.)
// MODIFIERS
const double Pi = 3.141592653; // Const means that a variables value cannot be changed
long int LINT = 9223372036854775807; // Long can be used on double and int and doubles the numbers size
short int SHINT = 32767; // Short affects int and halfs its size
}
The main way to output to the console in Quantum C is std::qout.
Example:
std::qout << "Hello, World" << '\n';
Hello, World! didnt you)