we have been doing some multi- file program examples in class. Doing multi file programs keep your code more organized. It takes longer and uses more over head to use muli-file programs.
In class we have been learning about multi-file programs, and in order to do that you need to create .o files. I learned you have to make a .h file w/ a corresponding .cc file, in order to get a .o file. then include that header file in your program using “” instead of <>
Today in C/C++ class we learned a little more about classes. We talked about the “friends” class. I learned that kids cannot access their parents private parts, but friends can access their parents private parts.
today in C/C++ class Matt reviewed a little bit about forms. Forms cannot be used for every thing, but if you are in a situation where a form could be used it will save a lot of time, and code.
protected class
protected base class can be accessed by a friend or member of any class by using a pointer to reference it.
friends class
can declare an external function as friend class to get access to the private and protected parts of the class
polymorphism
polymorphism is making a variable, objects, or function have more than one form.
File Access
accessing a file out side of the program to use by, and either reading, writing, or appending that file. to read you put “r” to write you put “w”
command line arguments
an argument sent to a program being called. usually you type in the command prompt the name of the program followed by you command line argument like a file.
Demonstration of the chosen keyword.
lab46:~$ ./test file.csv
cin
in C++ found in the header file iostream, overloads the left bit-shifter operator. usually takes info from user through keyboard. syntax is »
Demonstration of the chosen keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
/* * Sample code block */ #include <iostream> int main() { cin>>x>>y: return(0); }
cout
in C++ found in the header file iostream, overloads the right bit-shifter operator. standard out put is usually the screen. syntax is «
Demonstration of the chosen keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
/* * Sample code block */ #include <iostream> int main() { cout<<"this is going to the screen"<<"\n"; return(0); }
cerr
in C++ found in the header file iostream. The error output, normally the screen. syntax is «
Demonstration of the chosen keyword.
If you wish to aid your definition with a code sample, you can do so by using a wiki code block, an example follows:
/* * Sample code block */ #include <iostream> int main() { cerr << "Error message : " << str << endl; return(0); }
-write and compile code that utilizes programming constructs -use pointers and variables to discover the indirect properties of data storage -comprehend the basics of memory management, data representation and storage -identify and label various data types as scalar vs. composite -distinguish and explain difference between homogeneous and heterogeneous composite data types -break down and separate code into functions and illustrate the use of parameter passing -justify the use of various programming constructs within code solutions -discover the standard libraries and use libraries in solving problems
students should be able to -Write programs -use pointers effectively -understand what memory management is. -use the different data types -use the different libraries to do what your trying to do
I will be measuring my success in this class on whether or not i will be able to complete the projects.
According to my method, i am understanding the basics of what i need to do, but when it comes to putting it all together in a programs by my self, i am only able to do about have of it. I end up needing to get assistance from Matt or class mates.
Reflect upon your results of the measurement to ascertain your achievement of the particular course objective.
i am doing pretty good there is definitively room for improvement i think my method is a pretty good way to measure success
What happens if i leave the semi colon off of the end of a printf statement
C pocket reference
Based on what i have been reading in the C pocket reference, if i leave a needed semi colon off of a printf statement it will give me a syntax error and not compile.
I am going to take the semi colon off of the Hello, world! program's printf.
When i took the semi colon off of the Hello, World! program and tried to compile it, the following error occurred: hello.c: In function 'main': hello.c:4: error: expected ';' before 'return'
Based on the data collected:
I can conclude that if you have even one syntax error it will not compile your code, but it is very helpful by telling you where it is ( even down to telling you what line in the code it is on)
What will a simple for loop do if i change i++ to i–?
C programming text book
Based on what i have read in the C book i++ increments by 1 every time it loops, my hypothesis is that i– will decrement by 1 every time it loops.
#include<stdio.h> int main() { int i; for (i = 0; i < 10; i--) { printf ("i=%d\n",i); } return 0; }
When i ran this program with i– in the for loop, it did decrement by 1 but it continuously looped, and i had to exit the terminal.
Based on the data collected:
I have concluded that you can increment and decrement in a for loop, just make sure you change the counter statement.
Perform the following steps:
Whose existing experiment are you going to retest? Provide the URL, note the author, and restate their question.
Evaluate their resources and commentary. Answer the following questions:
State their experiment's hypothesis. Answer the following questions:
Follow the steps given to recreate the original experiment. Answer the following questions:
Publish the data you have gained from your performing of the experiment here.
Answer the following:
Answer the following: