What you want |
What it is called |
Examples |
output | cout |
AddTwoNumbers.cc
Hello.cc
|
loops | for |
HelloFor.cc
ForStatistics.cc
|
loops | do .. while |
BiggestInt.cc
|
loops | while |
twoPower.cc (has never-ending loop)
AddWhilePositive.cc
|
input from user | cin |
HelloIn.cc
RandDemo2.cc
twoPower.cc
|
function |
|
FunctionFactorial.cc
HexagonValue.cc
RandDemo7.cc
|
definition | #define |
RandDemo2.cc
|
pass by reference | & |
SortReference.cc
SortReference2.cc
|
shared definitions | #include (header file) |
RandDemo2.cc and
rand.h
|
conditional |
if / else
|
HelloFor.cc
RandDemo5.cc
|
? (ternary operator) |
RandDemo2.cc
|
switch / case |
SwitchDemo.cc
CalculatorSwitch.cc
|
random |
random() (random integer between 0 and 231
|
RollDie.cc
RandDemo5.cc
RandDemo6.cc
|
srandom() (initialize/seed the generator) |
RandDemo2.cc (seeds using time)
RandDemo5.cc (user-supplied seed)
|
input from command line | argv, sscanf |
RandDemo4.cc
|
convert string to int or long int | sscanf |
RandDemo4.cc
|
integer arithmetic | unsigned int |
BiggestUnInt.cc
|
power (xy) | pow(x,y) |
twoPower.cc
|
bit-shift | (1<<i) |
BiggestUnInt2.cc
|
Examine memory bit by bit | & (bit mask) |
BitsOut.cc
BiggestUnInt2.cc
|
input from file | ifstream, open, getline, close |
ReadFile.cc
OpenFile.cc
|
remember variables | static |
StaticDemo.cc
|
arrays | float vector[3] |
ScalarProduct.cc
|
char phone[11] |
CharacterArray.cc
|
dynamically allocate memory for vectors/
arrays/
matrices | int *a, new, delete |
ArrayDemo1.cc
ArrayDemo2.cc
ArrayDemo3.cc
|
dynamically allocate double arrays/matrices | double *a, new, delete |
ArrayDemo4.cc
|
useful warnings when compiling | makefile |
Makefile
|
Classes | class |
SimpleClass.cc
|
rejects |
| |
RandDemo3.cc
|
convert between types | cast, reinterpret_cast, static_cast |
CastDemo.cc (not yet finished)
|
No comments:
Post a Comment