User Tools

Site Tools


opus:fall2011:drobie2:part2

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.

  • How did you do?
  • I still do not completely grasp why people allow this and put out these types/pieces of software, however it is amazing and I have to thank them dearly!
  • Room for improvement?
  • I need to use linux more in order to understand it.
  • Could the measurement process be enhanced to be more effective?
  • There could always be a test of knowledge about what the top Open Source programs are out there.
  • Do you think this enhancement would be efficient to employ?
  • Eventually yes if I ever needed to do some real hardcore troublshooting.
  • Could the course objective be altered to be more applicable? How would you alter it?
  • No, we're using this type of software, allowing us to play as we please.

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:

  • was your hypothesis correct? Yes
  • is there more going on than you originally thought? (shortcomings in hypothesis) No, a while loop depends on the DO statement

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:

  • was your hypothesis correct?
  • was your hypothesis not applicable?
  • is there more going on than you originally thought? (shortcomings in hypothesis)
  • what shortcomings might there be in your experiment?
  • what shortcomings might there be in your data?

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:

  • Do you feel the given resources are adequate in providing sufficient background information?
  • Are there additional resources you've found that you can add to the resources list?
  • Does the original experimenter appear to have obtained a necessary fundamental understanding of the concepts leading up to their stated experiment?
  • If you find a deviation in opinion, state why you think this might exist.

Hypothesis

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

  • Do you feel their hypothesis is adequate in capturing the essence of what they're trying to discover?
  • What improvements could you make to their hypothesis, if any?

Experiment

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

  • Are the instructions correct in successfully achieving the results?
  • Is there room for improvement in the experiment instructions/description? What suggestions would you make?
  • Would you make any alterations to the structure of the experiment to yield better results? What, and why?

Data

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

Analysis

Answer the following:

  • Does the data seem in-line with the published data from the original author?
  • Can you explain any deviations?
  • How about any sources of error?
  • Is the stated hypothesis adequate?

Conclusions

Answer the following:

  • What conclusions can you make based on performing the experiment?
  • Do you feel the experiment was adequate in obtaining a further understanding of a concept?
  • Does the original author appear to have gotten some value out of performing the experiment?
  • Any suggestions or observations that could improve this particular process (in general, or specifically you, or specifically for the original author).
opus/fall2011/drobie2/part2.txt · Last modified: 2011/11/01 03:41 by drobie2