Monday, May 12, 2014

Class of May 12, 2014

          Today was the last class of this semester. We reviewed for the final which is good because I want to get an A in the test in order to get an A in the course. I really learned a lot through out the semester and now I have to keep practicing in order to get better.

Wednesday, May 7, 2014

Class of May 7, 2014

          In today's class we discussed dynamic arrays. Dynamic arrays are arrays whose size is determined when the program is running, not when you write the program. I believe that these arrays are better than static arrays because they are more flexible and allow the user to determine the size.

Monday, May 5, 2014

Class of May 5, 2014

Happy Cinco de Mayo!!

          In today's class, we discussed pointers, the new operator, and the delete operator. Pointers tell us where a variable is located. It is really simple to understand.

To declare pointers:
ex: double *p;

The address of operator:
ex: p1 = &v1

The new operator creates a pointer to a new "nameless" variable of type int.
ex: p1 = new int

The delete operator immediately releases the memory space that will no longer be used by the program. This is a great tool since it prevents a program from taking all the memory.
ex: delete p;


Friday, May 2, 2014

Class of May 2, 2014

     In today's class, among many topics we discussed vectors. Vectors are like arrays that can change size as your program runs.

To declare a vector:

vector <int> v;

To access vector elements:

v[i] = 45;

cout << v[i];

To initialize vector elements we use the member function push-back. This adds the element in the next available position.

Don't forget to include the vector library!!

#include <vector>

Wednesday, April 30, 2014

Class of April 30, 2014

          In today's class we discussed chapter 8, "Strings and Vectors". It is important that when working with strings always leave an extra space in the elements for the null character '\0' which declares where the string ends. Declaring a C-string variable is done using an array of characters.

For example:
        char s[11];

         Returning to what I said earlier about saving an extra space character, declaring a C-string as char s[11] creates space for only 10 characters since the null character terminator requires the other (1) space.

Monday, April 28, 2014

Class of April 28, 2014

     In today's class, the professor discussed some concepts that after reading over the next lab assignment I know will help me in completing it. I am getting better at arrays I just need a little bit more practice. Hopefully during summer I will be able to complete some problems from COJ.

Friday, April 25, 2014

Class of April 25, 2014

      In today's class we discussed arrays in functions. They are declared using empty brackets. I need to review this concept once more to understand it better. Today we also discussed searching arrays. One way to search an array for a given value is to look at each element from first to last to see if the target value is equal to any of the array elements.


Wednesday, April 23, 2014

Class of April 23, 2014

      In today's class we finally discussed arrays! I wished we would have discussed it before having to do Lab #6. An important thing I learned is that square brackets [ ] in a declaration means how many variables and square brackets [ ] outside means which one. A topic I need to review is Arrays in Functions because I had some trouble understanding it completely.

Wednesday, April 9, 2014

Class of April 9, 2014 (Midterm #2)

     Today was the second midterm. I cannot believe how hard it was for me. There were many parts I was not able to complete. I am very slow at writing programs which is why I had some trouble on the test and know now that I need to practice more on COJ.

Monday, April 7, 2014

Problems with Lab #6!!

      I began doing Lab #6. I cannot believe how hard it is. I was able to do the first two without any problem but now I am stuck on the others. I just wish the professor would teach us first what he assigns us to do on the labs. I understand what he means for us to do (read ahead and learn) but for me, a newbie, it is really hard to understand what needs to be done if there is no one to explain it to me even if I read ahead. Especially now that things are getting a lot more complicated. I cannot get a bad grade on this assignment when I am almost finishing the course.

Friday, April 4, 2014

Class of April 4, 2014

     In today's class we started to review for the second midterm. Wow, I cannot believe the semester is almost over. We only have left a few more assignments and then we are done. Back to the midterm review, I really need to study more because there are some topics which I am not dominating much. I need to practice before April 9.

Wednesday, April 2, 2014

Class of April 2, 2014

     Some of the subjects we covered in today's lecture were: creating space in output, using flags, the setw and setprecision manipulator, among others. I found the setw manipulator a bit confusing at first but after reading over it again I understood what it does and I even did an example from the chapter slides. I really need to go over again all the slides especially this chapter since the test is next Wednesday and I am pretty confused. I hope lab 6 isn't that hard either.

Monday, March 31, 2014

Class of March 31, 2014

     Common reasons for open to fail include: that the file might not exist or that the name that was typed is written incorrectly. To catch errors we use member function fail. Fail will return a bool value and if this value is true, the stream operation failed. The function exit, halts a program which is what is best to do when a stream open function fails.

Friday, March 28, 2014

Class of March 28, 2014

     In today's class we begun chapter 6. It is about I/O streams. I/O refers to program input and output. Files for I/O are the same type of files used to store programs. As programmers, we should use files because they allow us to store data permanently which means that we do not have to input the same things every time we run the program and it makes life a whole lot easier and saves us time if the program requires a lot of input.

Defining input-file and output-file streams:
     #include <fstream>
     using namespace std;

Declaring input-file stream:
     ifstream     in_stream;

Declaring output-file streams:
     ofstream    out_stream;


Wednesday, March 26, 2014

Class of March 26, 2014

     Today the professor took some time to clear our doubts regarding the lab assignment. I am nervous because even though I already finished the first 4 problems, I have yet to start problem number 5. I think I am in denial because it looks really hard and long. Regardless, I have done pretty well in all labs therefore I am going to spend all these next days doing the fifth problem and hope for the best.

Monday, March 24, 2014

Testing! Class of March 24, 2014

In today's class I learned different types of testing like: unit, integration, and system. Unit testing tests individual parts. Integration testing joins all the programs you unit tested to see if they work. System testing tests correctness and that system runs correctly. An important rule for testing to remember is that the programmer needs to "test every function in a program in which every other function in that program has already been fully tested and debugged".

Friday, March 21, 2014

Class of March 21, 2014

In today's class we discussed preconditions and postconditions. A precondition states what is assumed to be true when the function is called. A postcondition describes the effect of the function call.

for example:

void swap_values (int&n1, int&n2);
//Precondition: n1 and n2 have been given values
//Postcondition: the values of n1 and n2 have been interchanged

Preconditions and postconditions are helpful because:
1. they specify what a function should do
2. they minimize design errors and time wasted writing code that does not match the task at hand

Wednesday, March 19, 2014

Class of March 19, 2014

     In today's lecture, the professor discussed: void functions and call-by-reference parameters. Void functions do not return a value. I remember that I used void functions for one the labs, the problem that outputs the horoscopes. Call-by-reference parameters allow us to change the variable used in the function call. Call-by-reference parameters are useful but the programmer has to be careful when he or she uses them.

Monday, March 17, 2014

Class of March 17, 2014

     In today's lecture we covered: local variables, global constants, and global variables. Global constants are very good and helpful but global variables should be avoided because they make the program hard to understand.

Friday, March 14, 2014

Labs, again...

     I was able to finish and submit lab 4 by today. I had to rewrite the problem about the "99 bottles of beer…" because of some missing curly braces. After working with it for like 4 hours, until I believed it was perfect, I completed it and it feels good! 3 more labs to go… :-)

Wednesday, March 12, 2014

Lab 4

     My lab 4 is in progress. I like to take at least one week to do each lab just so that I have enough time to ask the professor any questions that will clarify doubts and that way not feel rushed or like I am doing a bad job. I've realized that I do not like the problems that have anything to do with interest rate. I don't know why, but I just do not like them.

Monday, March 10, 2014

Functions!

     Functions are very useful in programming. I've already used programmer-defined functions in lab 3 and I'm pretty sure I'll have to use them in the next labs that come.

The Function Declaration:
ex:

int result (int x, int y);
//Adds x and y and outputs the result.

The Function Call:
ex:
   
sum = result ( x , y );

The Function Definition:
ex:

int result (int x, int y)
{
int sum;

sum = x + y;
return (sum);
}

Friday, March 7, 2014

Class of March 7, 2014

     On today's lecture, the professor discussed predefined functions like: abs(x) which computes the absolute value of a variable and fabs(x) which also computes the absolute value but in this case it is of a type double variable. We also discussed type casting but the professor told us it was not a good idea to use this in programs.

Wednesday, March 5, 2014

Midterm #1

       Today we took our first midterm. Although I studied, I am not feeling too confident about my grade. The first part, program comprehension, was tough and I doubt I did it correctly. I simply hope to pass this test and do better on the next one.

Monday, March 3, 2014

Class March 3, 2014

    Today during class we reviewed for the test and I am feeling confident. I practiced with it by myself and was able to do it correctly and then run the programs in the compiler to check if my answers were correct. I also reviewed with the chapter slides. I hope it all goes well on the test...

Friday, February 28, 2014

Lab #3

     Today in class we discussed our doubts about Lab #3. This was really helpful since I had some doubts that I needed to clear out about some problems before being able to finishing the assignment. I realized that I tackled the problem about the interest rate wrong. Although I was then able to discuss it with the professor during his office hours, I don't think it is completely correct. I hope he at least gives me partial credit.

Wednesday, February 26, 2014

Loops

      Today we learned about another loop called a for-loop. This loop is sometimes more convenient to use than a while-loop, although it does not do anything a while-loop cannot do. Loops are really helpful for some programs. There are many different loops to use, I guess it is up to the programmer to choose which one he or she thinks suits best.

Monday, February 24, 2014

Class February 24, 2014

      During today's course, we discussed the difference between post-increment and pre-increment which I finally understood. We also discussed the switch-statements. At the beginning of the class the professor announced the date for the programming competition and it got me thinking that I would really like to participate in one of those some day when I get better, hopefully next year.

Friday, February 21, 2014

Class February 21,2014

    Today in class we discussed multiway branches. A regular branch can only give you one of two outcomes. In a multiway branch since there are branches within branches, there can be more possibilities.

Example:

if (guess > number)
     cout << "Too high.";
else if (guess < number)
     cout << "Too low.";
else if (guess == number)
     cout << "Correct!";

Wednesday, February 19, 2014

Class February 19, 2014

     Today's class felt eternal. It was a 2 hour lecture and we covered chapter 2 and even began with chapter 3. We went over so many different topics. Some of the material we covered today include: flow of control, loops, and program style. I also learned which are bad comments and which are good, and that I am probably going to get some points off my second lab for writing bad comments.

Tuesday, February 18, 2014

tuesday == monday

     Like always, Colegio does it best and unique. Today was tuesday with monday classes. The date for our first test has been set and I am really nervous. Right now I'm trying to finish all the quizzes, although they seem to never want to end. I really have a lot of work ahead of me.

Friday, February 14, 2014

Happy Valentine's Day!



Roses are red
Violets are blue
My lab isn't finished
What am I to do?!

Wednesday, February 12, 2014

COJ day

     I love doing COJ problems in class! Today I was able to submit another problem and it got accepted. I'm slowly but surely moving up. I really want to be able to solve harder problems. I know I have to practice in order to get better, still I get a little jealous when other classmates are able to solve problems I can't. I wish I would've had the opportunity to learn programming in high school so that I could have something to stand on but I have to work with what I got. I might not be the best programmer in the class, and this I am sure, but I really love to program and I want to make it my career. Like Confucius once said: "Choose a job you love, and you will never have to work a day in your life".

Monday, February 10, 2014

Success!


   
     Today I saw my lab's grade… I got a 97% woooh!! YAY! I hope they keep on coming like this. I really worked hard on it and I'm currently working hard on lab 2. I really want to get an A in this class but I know it won't come easy. Like every other class I have to work hard and maybe even harder on this one since it relates to my major therefore it is important I pass it with a good grade. Let's keep the A's coming!

Friday, February 7, 2014

Lab 2

     I've been working really hard on lab 2 since it was assigned. I'm excited for the program of Rock-Paper-Scissors since I think that will be so fun to do and later play. Right now I'm stuck on problem 2 which asks us to find how much diet soda pop it is possible to drink without dying as a result. The thing is that I am having trouble writing it out as an equation to then solve it. Good thing I like to start early so that I have enough time to clarify any doubts.

Wednesday, February 5, 2014

Almost done...

       I'm one problem away from finishing my second lab. I was so excited to be able to create the different programs I was asked to make, especially the rock paper scissors game (although this one was pretty confusing/hard for me to do). The hardest for me has been the second problem, which is about artificial sweetener. I have yet to complete it but I haven't been able to finish the algorithm. I am excited to keep doing programs. I realized that I prefer when we work on the computers in the classroom rather than the lectures. Our first exam will be soon and I have to begin to study. I'm pretty scared for it because I don't know what to expect and if it requires us to solve a complicated problem I'm scared I won't have enough time, since I sometimes take a lot trying to solve the algorithm. Either way I'll study and do my best, hopefully it will be enough.

Monday, February 3, 2014

Quizzes, quizzes, and more quizzes!

     I began to do some of the quizzes. Good thing there is no date limit, yet, for them because they are A LOT. I know I'm going to take some time doing them, especially since I want to get 13/13 in all of them. I've been doing some during class although they are not easy, therefore I sometimes choose to do them at home for better concentration and because I do not want to miss anything important that the professor mentions during class. The thing is most of them repeat the same questions which is a good way to learn because while you are answering the same question over and over again your brain starts to memorize the answer. I don't know if the professor did it with that intention in mind but either way it works.

Friday, January 31, 2014

T -3 days for due date

    I've been working hard on Lab 1 and the first problem was tricky, especially since I always over-analyze things. After expressing my doubts to the professor, I realized that the answer was actually really simple. To me, the tough parts of this lab have been answering the questions like: "Explain in your own words what the command line options -Wall and -c do". I still have t -3 days for due date, I can do it!

Wednesday, January 29, 2014

First Program WOOH!

      Today's class was so awesome! For the first time I was able to create a program without help and it got me excited. It was a simple program. I simply had to make it so that the two numbers that I introduced into the program were added. Either way it got me motivated. I'm seriously looking out for the future and I hope to be able to keep solving more problems from the Caribbean Online Judge. Hopefully one day I'll be able to create my own programs and apps.

Monday, January 27, 2014

Class January 27, 2014

Today I learned that the most important part of the source code is:

The program begins with the following lines:
 
#include <iostream>
using namespace std;
int main 
{

The program ends with the following two lines:

return 0;
}

** Without these lines there wouldn't be a program.** 

Friday, January 24, 2014

So far I've learned:


The 3 main classes of computers:
1- PCs
2- Workstation
3- Mainframe

In computer organization, the 5 main components:
1- Input devices (ex: mouse, scanner etc.)
2- Output devices (ex: printer, speaker etc.)
3- Processor
4- Main memory
5- Secondary memory

Did you know? 1 byte = 8 bits.

The processor can typically:
1- add
2- subtract
3- multiply
4- divide
5- move data from location to location

Wednesday, January 22, 2014

Computers are all around us

When you mention the word computer to a person they probably only think of:









But, did you know that all of these artifacts can also be considered computers?











Even cars and microwaves have computers in them. The list can go on and on.

Monday, January 20, 2014

We learn something new everyday...

       I used to think a programmer wrote lots of zero and one patterns to create a program, hence the name of this blog, but I've learned that it's not like that at all. So in some way, for now, I believe this course is going to be a little easier than I thought. I guess I feel dumb when I look back at that thought. Good thing is we learn something new everyday and that is how we grow.

Friday, January 17, 2014

Class January 17, 2014

Today I learned a few commands, for example:

     ls - list files in my home
     control (ctrl) r - reverse i search
     control (ctrl) c - abort
     mkdir - creates directory
     cd - change directory

Wednesday, January 15, 2014

First Day of Second Semester, First Day of COMP3010


       I am very excited because I found today’s discussion really interesting. What appealed to me the most was the Caribbean Online Judge (COJ), which I hope to soon be contributing to.  My main objective is to really understand how to program with C++. I’m a little scared since I have never worked with any programming language and I’m afraid it will be too hard, yet I remain optimistic.