Table of Contents

C/C++ Programming Journal

January 2014

Week One

*Learned some basic C programming etiquette and vocabulary.

 #include <stdio.h>
$ gcc -o hello hello.c
$ ./hello
Week Two

There are things called file pointers. They show where things will display to/from.

  1. STDIN - from the keyboard
  2. STDOUT - to terminal
  3. STERR - to terminal

Some commands:

  1. printf makes stuff appear on the screen via the work of sorcery. It's actually a shortcut for a longer command , fprintf(stdout, “yourmessage”);.

There are two ways to approach problems that you need to solve in C.

There are ways of specifying formats using printf:

Anything you see in the format of _x_ _ indicates that it is a hexadecimal value. For example:

hexadecimaloctalunsigned decimalsigned decimalunsigned binary
0 00 00 +0* 0000
1 01 01 +1 0001
2 02 02 +2 0010
3 03 03 +3 0011
4 04 04 +4 0100
5 05 05 +5 0101
6 06 06 +6 0110
7 07 07 +7 0111
8 10 08 -8 1000
9 11 09 -7 1001
A 12 10 -6 1010
B 13 11 -5 1011
C 14 12 -4 1100
D 15 13 -3 1101
E 16 14 -2 1110
F 17 15 -1 1111

*obviously zero has no sign, this is just how the computer handles it.

A lot of your regular punctuation are actually operators in C. There are two main forms:

Here is an example of the use of arrays in code form:

  1 #include <stdio.h>                                                                    
  2 #include <stdlib.h>
  3 int main ()
  4 {
  5     int i, *scores, sum=0, total;
  6     float average;
  7     printf("How big is the array?\n");
  8     scanf("%d", &total);
  9     scores=(int *)malloc(sizeof(int)*total);
 10     for (i=0; i<total; i++)
 11     {
 12         printf("enter test score %d/%d: ",(i+1), total);
 13         scanf("%d", (scores+i));
 14     }
 15     for (i=0; i<total; i++)
 16         sum= sum + *(scores+i);
 17     average =(float)sum/(float)total;
 18     printf("average is: %3.2f\n", average);
 19     return(0);
 20 }
Some Formatting Nonsense

*so, if you want your output to have all sorts of “organization” and “readability” and other such nonsense spewed by bureaucratic hippies (communists), there is a variety of tools you can utilize in the C/C++ programming system, published by Nintendo.

    4
    5
    6
    7
    8
    9

etc…

00004
00005
00006
00007
00008
00009

etc…

HPC Fundamentals Journal

January 2014

Week 1

*Tuesday

-$ tail -f var/log/daemon.log

-Thursday

  1. began the process of messing around with virtual machines. We put four towers together and put debian 7 (wheezy) on them, essentially.
    1. First, we attained the towers from the Pile O' Computers located in the middle of the room. We then attained all of the necessary materials, e.g. working hard drives, memory, power cords, monitors, keyboards, etc. Then we plugged everything in and started them up, and manually installed Debian 7 via an ethernet port in the offbyone subnet. This took some time. We will likely continue this project further to do other cool things with it.

Week 2

*We've continued working on the Virtual Machine project. We got onto our new machines and began installing important extras, like vim and Xen.

$ apt-get install package

or

$ apt-cache search package

versus:

$ aptitude search package

or

$ aptitude install package

-Some other formats of aptitude are:

  1. aptitude update
  2. aptitude upgrade
xen-create-image --verbose --hostname=test --dhcp --vcpus=2 --pygrub --dist=wheezy --force
$ useradd horus
$ passwd horus
Taking Dumps