======Part 1====== =====Entries===== ====Entry 1: August 31, 2012 Data==== * What action or concept of significance, as related to the course, did you experience on this date? The creation of the program called size.c. * Why was this significant? This is significant because you can determine your current character sizes, in bytes, based upon your current working console. >> My code for the program below: #include #include int main() { unsigned short int usi=0; unsigned int ui=0; unsigned long int uli=0; unsigned long long int ulli=0; unsigned char uc=0; // char is 8 bits (256 bits, 0-255) unsigned char carry=0; unsigned char quantity=0; quantity =uc-1; uc=quantity+1; if (uc> The code for this program is below: #include #include int main() { int a=12; int *b; b=&a; // changing values can lead to segmentation faults ex) b=2600 printf("a is located at 0x%X\n", &a); printf("b is located at 0x%X\n", &b); printf("b, when dereferenced, points to %d\n", *b); // dereference= a value printf("b contains 0x%X\n", b); return(0); } * Why was this significant? The significance of this program that is shows how the use of pointers work in use. * What concepts are you dealing with that may not make perfect sense? The "0x%", I don't fully understand what this is trying to accomplish. * What challenges are you facing with respect to the course? How exactly & work, and how to use them efficiently. ====Entry 3: September 12, 2012 Discrete==== What action or concept of significance, as related to the course, did you experience on this date? >>Created my own program that showed the relations to my logic choosing, based around the thought of converse implication. >>My code for my logic program: (called ctruth.c) #include #include int main() { char logicor(char, char); int p = 0; int q = 0; int XNq(int p, int q); int result = 0; if ((p = 0) || (q = 0)); result = 0; if ((p = 0) || (q = 1)); result = 1; printf(" \n"); printf("Your Converse Implication Truth Table.\n"); printf(" \n"); printf("P | Q | XNq \n"); printf("_ _ _ _ _ \n"); q = 0; printf("%d | %d | %d \n", p, q, (p, q)); // all 0's q = 1; printf("%d | %d | %d \n", p, q, (q, p)); // when Q is false p = 0; printf("%d | %d | %d \n", q, p, (q, q)); // when Q is True p = 1; printf("%d | %d | %d \n", q, p, (p, 0)); // when P is False printf(" \n"); printf("Please enter the value for P: \n"); scanf("%d", &p); getchar(); printf("Please enter the value for Q: \n"); scanf("%d", &q); getchar(); putchar() printf(" \n"); if (p != q) { printf("Converse Implication Result.\n"); printf("F | T | F \n", p, q, (q, p)); printf(" \n"); } else (p + !q); { printf("Other Results.\n"); printf("T | T | T \n", p, q, (p, q)); printf("T | F | T \n", q, p, (p, q)); printf("F | F | T \n", q, p, (p, q)); } int XNq(int p, int q); return (0); } Why was this significant? This was significant because it was a project needed to be done for a grade. What concepts are you dealing with that may not make perfect sense? The concepts of printf syntax of formatting a line. What challenges are you facing with respect to the course? The understanding of pointers and how to use them effectively. ====Entry 4: September 7, 2012==== What action or concept of significance, as related to the course, did you experience on this date? Learned about pre-processing directories, including the #include and #define, #ifdef, #endif. Why was this significant? These are used to make source programs easy to change and easy to compile in different execution environments. Directives in the source file tell the preprocessor to perform specific actions. What concepts are you dealing with that may not make perfect sense? Which directories to use to execute a certain function correctly. What challenges are you facing with respect to the course? Syntax involved with the typedef keyword. =====Keywords===== {{page>datapart1&nofooter}} {{page>discretepart1&nofooter}} =====Experiment 1===== ====Question==== What is the question you'd like to pose for experimentation? State it here. >> Are there other escape sequences to meet a variance of needs, other than (\n) for a new line? ====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. >> Chapter 2: Types, Operators, and Expressions. The C Programming Language Book. ====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. >> I believe the result of my experiment go as I intend it to end, by that I mean that the proper escape sequence will do its function. State your rationale. >> My rationale for this would be that my trust in the program will run correctly, not segmentation faults or anything controversial to the situation. ====Experiment==== How are you going to test your hypothesis? What is the structure of your experiment? >> I am going to test my hypothesis by writing that program that will use some of the escape sequences. My data will show whether or not these escape sequences worked correctly or not. The structure of my program will be a line of printf statements using a certain escape sequence. ====Data==== Perform your experiment, and collect/document the results here. "The complete set of escape sequences is: " \a alert (bell) character \\ backlash \b backspace \? question mark \f formfeed \' single quote \n newline \" double quote \c carriage return \ooo octal number \t horizontal tab \xhh hexadecimal number \v vertical tab Code for such program below: #include #include main () { int input; printf("Hello There\a -> alert (bell) character\n"); printf("Hello There\b -> backspace\n"); printf("Hello There\f -> formfeed\n"); printf("Hello There\n -> newline\n"); printf("Hello There\t -> horizontal tab\n"); printf("Hello There\v -> vertical tab\n"); printf("Hello There\\ -> backslash\n"); printf("Hello There\? -> question mark\n"); printf("Hello There\' -> single quote\n"); printf("Hello There\" -> double quote\n"); return(0); } Results from running such code: Hello There -> alert (bell) character Hello Ther -> backspace Hello There |-> formfeed Hello There |-> newline Hello There -> horizontal tab Hello There |-> vertical tab Hello There\ -> backslash Hello There? -> question mark Hello There' -> single quote Hello There" -> double quote ====Analysis==== Was your hypothesis correct? >> Yes, my hypothesis was correct. Was your hypothesis not applicable? >> My hypothesis was applicable, as shown above. Is there more going on than you originally thought? (shortcomings in hypothesis) >> The form-feed and the newline options produce the same result. What shortcomings might there be in your experiment? >> Not using all the escape sequences, for example \r (carriage return), this was not possible in my current experiment. What shortcomings might there be in your data? >>Not showing all the escape sequences shown in the table, as it was not possible in my current experiment. ====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. >> Based on the data collected I can say that escape sequences can be very useful, if used correctly, if not your statement will look awful. Discoveries made are that \f (form feed) and \n (newline) are relatively the same thing, they produce the same output. Form feed is now an outdated command, so no need to worry about its usage.