Table of Contents

Part 2

Entries

October 6th, 2011

Began to finish up the project (from about 2 weeks ago) and learned what the actual output commands are for displaying the size of the datatypes, still am trying to figure out how to display how many values they can hold. This is significant because being able to display information is an essential part of any program.

October 20th, 2011

Began studying arrays, I really do not understand and still slightly struggling with this class in general. Going to attempt to a make an array example program called Billy.

October 29th, 2011

Code for the array program is as follows

// arrays example
#include <iostream>
using namespace std;

int billy [] = {16, 2, 77, 40, 12071};
int n, result=0;

int main ()
{
  for ( n=0 ; n<5 ; n++ )
  {
    result += billy[n];
  }
  cout << result;
  return 0;
}

I cannot get this to work, will continue working on it further.

October 30th, 2011

I have slane Gywn, Lord of Cinder, and purged the land of all darkness earning the title Lord of Cinder for my own in Dark Souls.

cprog Topics

Assembler

Inline assembly is important because of its ability to operate and make its output visible on C/C++ variables. It is mainly used to instruct a complier to insert the code of a function so that it may be interperated.

asm("assembly code")

Linker

A linker is used to defideclare an object in a program from an outside program/source.

$ linker example.c
#include "use_me.h"

void bar()
{
        use_me(23);
}

C Library

Allows C and C++ programs to work by including header and essential program data without having to code every piece of that information in.

/*
 * Sample of Library
 */
#include <stdio.h>

Makefiles

Makefiles are special format files that together with the make utility will help you to automagically build and manage your projects.

lab46:make -f MyMakefile

Scope

Scope refers to the functions, class, types and variables and is that part of the source code where the particular identifier is visible.

#ifndef Variable
 #define Variable
 

Pointers

A pointer is a data type which directly relates one variables values to another variable either through storage or just replacement.

int *ptr;

Type Cast

A type cast provides a method for explicit conversion of the type of an object in a specific situation.

int main() {
double x = 3.1;
int i;
cout << "x = " << x << endl;
i = ( int )x;                     // assign i the integer part of x
cout << "i = " << i << endl;
}

Sequence Structures

Sequence structures perform tasks without breaking the flow of the program itself.

Version Control

Version Control allows you to keep track of changes to coding throughout many different languages, helping to prevent a massive change that would destroy the program/application.

Namespaces

Namespaces allow you to group different “entities” together under a specific name.

 namespace ExampleName
{
  int a, b;
}
 

Type Casting Operators

Allows you to convert a given expression into a different type of expression.

short a=2000;
int b;
b=a;

Arrays

An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.

cprog Objective

Objective

Exposure to Open-Source concepts and ideals.

Method

By using unbuntu more within different classes, I am gaining the basic concepts of open-source programs and logic.

Measurement

By using ubuntu/linux as an operating system has made me notice how it's great to have a system in which the user can actually modify it and make it their own, without needing to create their whole operating system.

Analysis

Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.

Experiments

Experiment 1

Question

What happens if you replace a “for” statement with a “while”?

Resources

The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie

Hypothesis

The program will not run because there will be no “do” statement for the while to depend on.

Experiment

#include <string.h>

/* reverse: reverse string s in place */ void reverse(char s[]) {

      int c, i, j;
      for (i = 0, j = strlen(s)-1; i < j; i++, j--) {
              c = s[i];
              s[i] = s[j];
              s[j] = c;
              }

} replace “for” with “while”

Data

THe program does not run with “while” in place of the “for”

Analysis

Based on the data collected:

Conclusions

For loops and While loops can be used interchangably, however you just need to make sure you use them correctly and do not mismatch the coding.

Experiment 2

Question

What is the question you'd like to pose for experimentation? State it here.

Resources

Collect information and resources (such as URLs of web resources), and comment on knowledge obtained that you think will provide useful background information to aid in performing the experiment.

Hypothesis

Based on what you've read with respect to your original posed question, what do you think will be the result of your experiment (ie an educated guess based on the facts known). This is done before actually performing the experiment.

State your rationale.

Experiment

How are you going to test your hypothesis? What is the structure of your experiment?

Data

Perform your experiment, and collect/document the results here.

Analysis

Based on the data collected:

Conclusions

What can you ascertain based on the experiment performed and data collected? Document your findings here; make a statement as to any discoveries you've made.

Retest

If you're doing an experiment instead of a retest, delete this section.

If you've opted to test the experiment of someone else, delete the experiment section and steps above; perform the following steps:

State Experiment

Whose existing experiment are you going to retest? Prove the URL, note the author, and restate their question.

Resources

Evaluate their resources and commentary. Answer the following questions:

Hypothesis

State their experiment's hypothesis. Answer the following questions:

Experiment

Follow the steps given to recreate the original experiment. Answer the following questions:

Data

Publish the data you have gained from your performing of the experiment here.

Analysis

Answer the following:

Conclusions

Answer the following: