======Part 2======
=====Entries=====
====Entry 5: March 6, 2012====
Today we learned about typedef. I still don't know more then the basics of it but it allows you to create an alias for a function like " typedef int i" allows the user to now say "i x" instead of "int x". This is just the tip of what it can do i would guess. We also learned about union and struct containers along with a class but that is not a container. These containers are heterogeneous and don't have to contain the same type of data. they can hold ints and chars. Arrays are homogeneous meaning they can only hold one type of data. We also learned that adding -g to our gcc we can allow for debugging when we type gdb ./progname . this is useful because everyone likes to debug.
====Entry 6: March 13, 2012====
Today we manipulated our first C++ program into file separation and rejoined them up making our original program and script shorter. This idea allows us to sepperate the functions of a program into smaller pieces that may seem more manageable and make our final script look just that much nicer. this is good for working in groups so that each person can take a chunk and work on it then piece it all together again later.
====Entry 7: March 15, 2012====
Today we discussed the project2 and the importance of Paper. Why is paper important. (i use a whiteboard at home and a camera) Paper helps one organize their thoughts and visually see the code in their head before typing it all out. Paper also helps you run through problems to see an exact process you think it will follow. It doesn't help with syntax but it will help with your logic. Object oriented programming teaches us that paper is key and it never hurts to make some psuedocode and a uml document sometimes.
====Entry 8: March 1, 2012====
(yes this is out of order)
Today we discussed ways to fix project 1 by either flipping the letters back to the beginning of the alphabet or by changing all letters to their ASCII chart equivalent numbers allowing for a lot more flexibility. We also looked at a project that was multifunctioned or had more then one function in the script that contained it. The program took a number and ran it through a series of tests to check and see if it was even or odd. This was a a huge change because it gave us a hint into how to better organize our data within a script.
=====Keywords=====
{{page>cprogpart2&nofooter}}
=====Experiments=====
====Experiment 4====
===Question===
Can I use OCT, HEX, and DEC work in an printf if they work in an I/O stream?
===Resources===
man 3 printf
===Hypothesis===
Yes i can convert things into HEX,DEC,and OCT format.
This is because C++ is a more simplified version of C so therefore C must have the functionality to do what C++ can but in a possibly harder format.
===Experiment===
How are you going to test your hypothesis?
I am going to test my hypothesis through attempting to give a variable "a" a value and convert that value in a printf statement into a different base.
===Data===
1 #include
2 #include
3
4 int main()
5 {
6 int a = 4923523;
7 printf("This is a in HEX : %x\n", a);
8
9 printf("This is a in OCT: %o\n", a);
10
11 printf("This is a as a plain DEC: %u\n",a);
12 return(0);
13 }
Here is the results.
lab46:~/src/cprog$ ./expiremnt4
This is a in HEX : 4b2083
This is a in OCT: 22620203
This is a as a plain DEC: 4923523
lab46:~/src/cprog$ vi expiremnt4.c
lab46:~/src/cprog$
===Analysis===
Based on the data collected:
* Was your hypothesis correct?
* yes
* Was your hypothesis not applicable?
* no
* Is there more going on than you originally thought? (shortcomings in hypothesis)
* no none that i could see.
* What shortcomings might there be in your experiment?
* it is possible i exclueded some factor like what if the number was already in hex and i tried to print it as hex would it still recognize it?(next expirement <(^^,)> )
===Conclusions===
It is possible to convert the results to different formats within the actual printf statement as one would do in a cout stream in c++.
====Experiment 5====
===Question===
Based on experiment 4. Would %x stay the same or change if i enter in a already HEX number?
===Resources===
experiment 4.
===Hypothesis===
I believe that it will remain the same.
The developers must have thought this idea through if they allowed for the conversion to take place at all. %u doesn't try and convert when a decimal number is already existent.
===Experiment===
I am going to change a in the above program and see if it can run the same three printf statements and comvert from hex and see if %x can recognize a hex digit and keep it the same.
===Data===
1 #include
2 #include
3
4 int main()
5 {
6 int a = 0x4b2083;
7 printf("This is a in HEX : %x\n", a);
8
9 printf("This is a in OCT: %o\n", a);
10
11 printf("This is a as a plain DEC: %u\n",a);
12 return(0);
13 }
This is my attempt at trying to input a hex digit. I tried it the first time and it did not like the numbers but i looked up some possible solutions and learned that the computer won't recognize a hex digit without 0x infront of it else it will just complain about the letters. Here are the results.
lab46:~/src/cprog$ ./expiremnt4
This is a in HEX : 4b2083
This is a in OCT: 22620203
This is a as a plain DEC: 4923523
as you can see this matches the above projects results.
===Analysis===
Based on the data collected:
* Was your hypothesis correct?
* yes
* Was your hypothesis not applicable?
* no
* Is there more going on than you originally thought? (shortcomings in hypothesis)
* i dont think so.
* What shortcomings might there be in your experiment?
* none that i can see
===Conclusions===
The way C was designed keeps it from excepting just letters as part of a number but with the right deffinitions on the number it can be seen as what the letters represent as with the 0x allowing letters up to f to be in a number as it is part of the hex digit system. The computer can also recognize and convert a hex digit to a dec or oct equivalent.
====Retest 2====
Perform the following steps:
===State Experiment===
Whose existing experiment are you going to retest? Provide 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).