Saturday, December 27, 2008

Learnings (BETINOL, lorebeth)

December 22- 26

No more class, its...... (ehem.. ehemmm.)whatt time is it.. its Christmas Vacation.

Happy Christmas to everyone.

Still learning:

The do-while Statement


- the do-while loop puts Boolean expression after the body of loop
- body will be always executed at least once
- if Boolean expression is TRUE, the loop will continue
- useful for selected applications
- example: read input and check if valid

Nested Loops

- often necessary for one loop to include another loop to solve a problem - need separate initializations, Boolean expressions, and increments

LEARNINGS OF THE WEEK (Dec. 22-26)
By: Frea Diane T. Bautista

yEehEey! it’s the stArt of x-mAs vAcatiOn alReadY!

..itS so happy and fun here!

..just resting and watching tv!

..suliton sa ang panahon!

..hehe!

..mErry x-mas 2 all!

..& happy b-day Jesus!

..mwAAAAhh!xD

December 22 - 26, 2008

By: Cielito M. Cantero


Santa Claus is coming to town!!!

Christmas na!!!

wLa nay learnings of the week ouie…

reSt muna…

oras na pwa mg-hapi2…

it’s Jesus Christ b-Day…

merry cHristmas 2 ol…

------------------------------------------------------------------------------------------------------------

eNjoy au…

:-) (n_n) (^_^) (--,) :o) :oD

Friday, December 26, 2008

Learnings of the Week!!


Steffany Queen P. Bigoy
CHRISTMAS WEEK. Ü

Sunday, December 21, 2008

December 15 - 19, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal


ReUnion… (hehehe)

We finally met our TLE teacher, Sir Ernie Balbuena, this week…

After so many days he had been gone, he finally showed up…

Because it’s a reunion we must be very happy…but it’s not…

We didn’t discussed new lesson but instead we have activity about function call again…

It was a surprise activity…and we don’t expect it!

But still, because of our intelligence (atik…), we still manage to solve it…

And also, this week, we are celebrating our CHRISTMAS PARTY!!!

But unfortunately, I wasn’t able to attend it because our family has important matter to do…

------------------------------------------------------------------------------------------------------------

huhuhu…

saYang!!!

laSt parTy na sNa….(T_T)

Saturday, December 20, 2008

LEARNINGS OF THE WEEK (Dec. 15-19)
By: Frea Diane T. Bautista

This week, we had an activity all about Function Call again.

Huhuhu

I only got 80!

Its because of the last minute changing of ideas!

..but still, its okay ‘coz we celebrated our Christmas Party on 19th, though its not so fun, I just got contented about it after receiving my gift from Aubrey!

..oOopZzZ!:)

Learnings of the Week!!

Steffany Queen P. Bigoy

Well, our teacher has finally showed up,
the he gave us activity. And luckily, we had solved it. Ü

Learnings ( LOREBETH BETINOL)

December 15-19

Teachers day had passed so, Mr. Balbuena gave us an activity this time which I'm not prepared of.

It's the turn of batch one to shine, I mean to do the activity Our teacher shuffled the usual seats I do not know why..

One of our classmate do it as fast as a lightning (*charr....) maybe because he really has a talent..

But me ... I have Nothing.

Even though I'm not prepared but still i got an average score.

Hey! This Friday will be our Christmas Party.. Thank God.

I'm still learning..

Saturday, December 13, 2008

LEARNINGS OF THE WEEK (Dec. 8-12)
By: Frea Diane T. Bautista

This week, we don’t also have a continuous class because teachers were still busy doing something.
We were just tasked by Sir Ernie to study the reports of the previous activities.

Hmmmm..maybe were having another activity..

Luckily, I thought something.

But still,
Hehehe..Christmas Party is already coming next week!..yeEeEhEy!

Learnings of the Week!!

Steffany Queen P. Bigoy

We are just reporting this week. ! Ü

Learnings (BETINOL, lorebeth)

December8-12

This week, we don’t also have a continuous class because teachers were still busy doing something.

We were just tasked by Sir Ernie to study the reports of the previous activities.


This week is the teachers day, i think that is the reason why they are busy so much...


Thanks to my classmates who reported and I knew something.


Which are the:

Common Errors


- extra semicolon after for (..) or while (..) causes zero line infinite loop
- counters (and other variables) not properly initialized
- Boolean expression will never become FALSE (infinite loop)
- loop executes incorrect number of times (off by one common)
- never update for loop counter variable inside for loop
- never use same counter variable for nested loops


December 8 - 12, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal

No cLass aGaiN…!

This week, teachers were so busy again and I don’t know why…

Maybe, because they’re doing some of their reports…

But still, we were tasked by our teacher to study the reports of our classmates in our activity last week…

And in the end, I still learned something about programming…

Thanks to my classmates who helped me…! (char!)

------------------------------------------------------------------------------------------------------------

tHat’s aLL…

tnx… (--,)

Sunday, December 7, 2008

December 1 - 5, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal

aNotHer nO No nO cLass!!!

Teachers’ Day is coming to town!!

We don’t have class in TLE this week because it’s teachers’ day…

Teachers were so busy practicing their presentation for their day…

Our TLE teacher, Sir Ernie Balbuena is one of the teachers participating the dance contest that will be held in the Tagum Trade Center…

Sir Ernie’s team done their best…And they got the 2nd place…

Next week, classes will be back to normal…

------------------------------------------------------------------------------------------------------------

huhuhu..

hehehe pala….

(“,)

Learnings of the Week!!


Steffany Queen P. Bigoy


Sir Ernie joining the dance contest?
Oh my God!! I cant imagine it. !! lol. Actually,
its Teacher's Day thats why we dont have c
lasses and again, dont have
learnings for this dweek. ! Ü

Saturday, December 6, 2008

LEARNINGS OF THE WEEK (Dec.1-5)
By: Frea Diane T. Bautista

This week, we don’t really have a continuous class this is because of the preparation for the Teacher’s Day!

Students and Teachers were so busy preparing presentations for this day.

And Take Note: Sir Ernie is preparing his dance number, together with his co-teachers for the said event.

Hehehe!

Learnings (BETINOL)

December1-5

Actually we don't have a class seriously because .. it is teachers day!!

Our TLE teacher is included in the dance contest so some of the reporters are task to report since we don't have a teacher.

It as more on examples about iterative statements.

terative Statements

Three types of iterative statement are provided in Magma: the for-statement providing definite iteration and the while- and repeat-statements providing indefinite iteration.

Iteration may be performed over an arithmetic progression of integers or over any finite enumerated structure. Iterative statements may be nested. If nested iterations occur over the same enumerated structure, abbreviations such as for x, y in X do may be used; the leftmost identifier will correspond to the outermost loop, etc. (For nested iteration in sequence constructors, see Chapter SEQUENCES.)

Early termination of the body of loop may be specified through use of the `jump' commands break and continue.

Subsections

Sunday, November 30, 2008

November 24 - 28, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal

nO No nO cLass!!!

Because of the Regional Press Conference that will be held in our school this week, we don’t have classes…

Teachers were so busy preparing for the Press Conference…

And students were also busy cleaning their respective rooms…

And so, we had no class for the rest of the day…

I learned nothing this week…

------------------------------------------------------------------------------------------------------------

..hehe,.

reSt na nMan…!!

yeheey!! :-)

Saturday, November 29, 2008

learnings (BETINOL)

November 24-28

Seriously I have nothing to learned.......................because everybody is busy cleaning their classrooms, performing their own task in preparation for the regional schools press conference..

it means that we don't have class most of the days.

so that's it.

Friday, November 28, 2008

Learnings of the Week!!

Steffany Queen P. Bigoy
Regional Press Conference. This is the reason
why we dont havr classes
and basically no learnings.

Tuesday, November 25, 2008

LEARNINGS OF THE WEEK (Nov. 24-28)
By: Frea Diane T. Bautista

This week, I learned nothing because we were busy cleaning our respective rooms and the teachers were also busy preparing for the event.

This is due to the Regional Press Conference that was held in our school.

Meaning, we had no class for several days.

..yEEEhEEEEy!!:)

Saturday, November 22, 2008

LEARNINGS OF THE WEEK (Nov. 17-21)
By: Frea Diane T. Bautista

This week, we discussed about Function Calls. He also taught us how t use them.
But what does Function Call really mean?
Function call operator ( )
A function call is an expression containing the function name followed by the function call operator, (). If the function has been defined to receive parameters, the values that are to be sent into the function are listed inside the parentheses of the function call operator. The argument list can contain any number of expressions separated by commas. It can also be empty.
The type of a function call expression is the return type of the function. This type can either be a complete type, a reference type, or the type void. A function call expression is always an rvalue. A function call is an lvalue if and only if the type of the function is a reference.
Here are some examples of the function call operator:
stub()
overdue(account, date, amount)
notify(name, date + 5)
report(error, time, date, ++num)
The order of evaluation for function call arguments is not specified. In the following example:
method(sample1, batch.process--, batch.process);
the argument batch.process-- might be evaluated last, causing the last two arguments to be passed with the same value.
Below is also another explanation of Function and Parameters.
A function is similar to a subroutine (Gosub) except that it can accept parameters (inputs) from its caller. In addition, a function may optionally return a value to its caller. Consider the following simple function which accepts two numbers and returns their sum:
Add(x, y)
{
return x + y ; "Return" expects an expression.
}
The above is known as a function definition because it creates a function named "Add" (not case sensitive) and establishes that anyone who calls it must provide exactly two parameters (x and y). To call the function, assign its result to a variable with the := operator. For example:
Var := Add(2, 3) ; The number 5 will be stored in Var.
Also, a function may be called without storing its return value:
Add(2, 3)
But in this case, any value returned by the function is discarded; so unless the function produces some effect other than its return value, the call would serve no purpose.
Since a function call is an expression, any variable names in its parameter list should not be enclosed in percent signs. By contrast, literal strings should be enclosed in double quotes. For example:
if InStr(MyVar, "fox")
MsgBox The variable MyVar contains the word fox.
In v1.0.47.06+, a function (even a built-in function) may be called dynamically via percent signs. For example, %Var%(x, "fox") would call the function whose name is contained in Var. Similarly, Func%A_Index%() would call Func1() or Func2(), etc., depending on the current value of A_Index. The called function's definition must exist explicitly in the script by means such as #Include or a non-dynamic call to a library containing the function. If the function does not exist -- or if the wrong number or type of parameters is passed to it -- the expression containing the call produces an empty string.
Finally, functions may be called in the parameters of any command (except OutputVar and InputVar parameters such as those of StringLen). However, parameters that do not support expressions must use the "% " prefix as in this example:
MsgBox % "The answer is: " . Add(3, 2)
The "% " prefix is also permitted in parameters that natively support expressions, but it is simply ignored.
Parameters
When a function is defined, its parameters are listed in parentheses next to its name (there must be no spaces between its name and the open-parenthesis). If a function does not accept any parameters, leave the parentheses empty; for example: GetCurrentTimestamp().
ByRef Parameters: From the function's point of view, parameters are essentially the same as local variables unless they are defined as ByRef as in this example:
Swap(ByRef Left, ByRef Right)
{
temp := Left
Left := Right
Right := temp
}
In the example above, the use of ByRef causes each parameter to become an alias for the variable passed in from the caller. In other words, the parameter and the caller's variable both refer to the same contents in memory. This allows the Swap function to alter the caller's variables by moving Left's contents into Right and vice versa.
By contrast, if ByRef were not used in the example above, Left and Right would be copies of the caller's variables and thus the Swap function would have no external effect.
Since return can send back only one value to a function's caller, ByRef can be used to send back extra results. This is achieved by having the caller pass in a variable (usually empty) in which the function stores a value.
When passing large strings to a function, ByRef enhances performance and conserves memory by avoiding the need to make a copy of the string. Similarly, using ByRef to send a long string back to the caller usually performs better than something like Return HugeString.
Known limitations:
• It is not possible to pass Clipboard, built-in variables, or environment variables to a function's ByRef parameter, even when #NoEnv is absent from the script. Passing a built-in variable to a ByRef parameter causes an error dialog to be displayed.
• Although a function may call itself recursively, if it passes one of its own local variables or non-ByRef parameters to itself ByRef, the new layer's ByRef parameter will refer to its own local variable of that name rather than the previous layer's. However, this issue does not occur when a function passes to itself a global variable, static variable, or ByRef parameter.
• If a parameter in a function-call resolves to a variable (e.g. Var or ++Var or Var*=2), other parameters to its left or right can alter that variable before it is passed to the function. For example, func(Var, Var++) would unexpectedly pass 1 and 0 when Var is initially 0, even when the function's first parameter is not ByRef. Since this behavior is counterintuitive, it might change in a future release.
Optional Parameters
When defining a function, one or more of its parameters can be marked as optional. This is done by appending an equal sign followed by a default value. The following function has its Z parameter marked optional:
Add(X, Y, Z = 0)
{
return X + Y + Z
}
When the caller passes three parameters to the function above, Z's default value is ignored. But when the caller passes only two parameters, Z automatically receives the value 0.
It is not possible to have optional parameters isolated in the middle of the parameter list. In other words, all parameters that lie to the right of the first optional parameter must also be marked optional.
In v1.0.46.13+, ByRef parameters also support default values; for example: Func(ByRef p1 = ""). Whenever the caller omits such a parameter, the function creates a local variable to contain the default value; in other words, the function behaves as though the keyword "ByRef" is absent.
A parameter's default value must be one of the following: true, false, a literal integer, a literal floating point number, or a quoted/literal string such as "fox" or "" (but versions prior to 1.0.46.13+ allow only "").

November 17 - 21, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal


Function Call???

If Mathematics has Functions, Computer Programming has Function Calls…

Function Call is the one that calls the function in doing its specified tasks…

We also tackled about the actual and formal parameters this week…

Below is the deeper explanation about the Function Call:

Most languages allow you to create functions of some sort. Functions let you chop up a long program into named sections so that the sections can be reused throughout the program. Functions accept parameters and return a result. C functions can accept an unlimited number of parameters. In general, C does not care in what order you put your functions in the program, so long as a the function name is known to the compiler before it is called.

We have already talked a little about functions. The rand function seen previously is about as simple as a function can get. It accepts no parameters and returns an integer result:

int rand()
/* from K&R
- produces a random number between 0 and 32767.*/
{
rand_seed = rand_seed * 1103515245 +12345;
return (unsigned int)(rand_seed / 65536) % 32768;
}

The int rand() line declares the function rand to the rest of the program and specifies that rand will accept no parameters and return an integer result. This function has no local variables, but if it needed locals, they would go right below the opening { (C allows you to declare variables after any { -- they exist until the program reaches the matching } and then they disappear. A function's local variables therefore vanish as soon as the matching } is reached in the function. While they exist, local variables live on the system stack.) Note that there is no ; after the () in the first line. If you accidentally put one in, you will get a huge cascade of error messages from the compiler that make no sense. Also note that even though there are no parameters, you must use the (). They tell the compiler that you are declaring a function rather than simply declaring an int.

The return statement is important to any function that returns a result. It specifies the value that the function will return and causes the function to exit immediately.

This means that you can place multiple return statements in the function to give it multiple exit points. If you do not place a return statement in a function, the function returns when it reaches } and returns a random value (many compilers will warn you if you fail to return a specific value). In C, a function can return values of any type: int, float, char, struct, etc.
There are several correct ways to call the rand function. For example: x=rand();. The variable x is assigned the value returned by rand in this statement. Note that you must use () in the function call, even though no parameter is passed. Otherwise, x is given the memory address of the rand function, which is generally not what you intended.
You might also call rand this way:
if (rand() > 100)
Or this way:
rand();
In the latter case, the function is called but the value returned by rand is discarded. You may never want to do this with rand, but many functions return some kind of error code through the function name, and if you are not concerned with the error code (for example, because you know that an error is impossible) you can discard it in this way.
Functions can use a void return type if you intend to return nothing. For example:

void print_header()
{
printf("Program Number 1\n");
printf("by Marshall Brain\n");
printf("Version 1.0, released 12/26/91\n");
}
This function returns no value. You can call it with the following statement:
print_header();
You must include () in the call. If you do not, the function is not called, even though it will compile correctly on many systems.
C functions can accept parameters of any type. For example:
int fact(int i)

{
int j,k;

j=1;
for (k=2; k<=i; k++)
j=j*k;
return j;
}
returns the factorial of i, which is passed in as an integer parameter. Separate multiple parameters with commas:
int add (int i, int j)
{
return i+j;
}
C has evolved over the years. You will sometimes see functions such as add written in the "old style," as shown below:
int add(i,j)
int i;
int j;
{
return i+j;
}
It is important to be able to read code written in the older style. There is no difference in the way it executes; it is just a different notation. You should use the "new style," (known as ANSI C) with the type declared as part of the parameter list, unless you know you will be shipping the code to someone who has access only to an "old style" (non-ANSI) compiler.

------------------------------------------------------------------------------------------------------------

lisod nOh??!!
..hahay..

Learnings - Nov. 17-21, (betinol)

This time we discussed about function call.
Here it goes:

Function Call Operator ( )

A function call is an expression containing a simple type name and a parenthesized argument list. The argument list can contain any number of expressions separated by commas. It can also be empty.

For example:

stub()
overdue(account, date, amount)
notify(name, date + 5)
report(error, time, date, ++num)

There are two kinds of function calls: ordinary function calls and C++ member function calls. Any function may call itself except for the function main.

Type of a Function Call

The type of a function call expression is the return type of the function. This type can either be a complete type, a reference type, or the type void. A function call is an lvalue if and only if the type of the function is a reference.

Arguments and Parameters

A function argument is an expression that you use within the parentheses of a function call. A function parameter is an object or reference declared within the parentheses of a function declaration or definition. When you call a function, the arguments are evaluated, and each parameter is initialized with the value of the corresponding argument. The semantics of argument passing are identical to those of assignment.

A function can change the values of its non-const parameters, but these changes have no effect on the argument unless the parameter is a reference type.

Linkage and Function Calls

C In C, if a function definition has external linkage and a return type of int, calls to the function can be made before it is explicitly declared because an implicit declaration of extern int func(); is assumed. This is not true for C++.

Type Conversions of Arguments

Arguments that are arrays or functions are converted to pointers before being passed as function arguments.

Arguments passed to nonprototyped C functions undergo conversions: type short or char parameters are converted to int, and float parameters to double. Use a cast expression for other conversions.

The compiler compares the data types provided by the calling function with the data types that the called function expects and performs necessary type conversions. For example, when function funct is called, argument f is converted to a double, and argument c is converted to an int:

char * funct (double d, int i);
/* ... */
int main(void)
{
float f;
char c;
funct(f, c) /* f is converted to a double, c is converted to an int */
return 0;
}

Evaluation Order of Arguments

The order in which arguments are evaluated is not specified. Avoid such calls as:

method(sample1, batch.process--, batch.process);

In this example, batch.process-- might be evaluated last, causing the last two arguments to be passed with the same value.

Example of Function Calls

In the following example, main passes func two values: 5 and 7. The function func receives copies of these values and accesses them by the identifiers: a and b. The function func changes the value of a. When control passes back to main, the actual values of x and y are not changed. The called function func only receives copies of the values of x and y, not the variables themselves.

/**
** This example illustrates function calls
**/

#include

void func (int a, int b)
{
a += b;
printf("In func, a = %d b = %d\n", a, b);
}

int main(void)
{
int x = 5, y = 7;
func(x, y);
printf("In main, x = %d y = %d\n", x, y);
return 0;
}

This program produces the following output:

In func, a = 12   b = 7
In main, x = 5 y = 7

Learnings of the Week!!


Steffany Queen P. Bigoy
Function call? Whats that steff?, kindly explain.
Ok.ok, I'll explain.
Its the summary:
A function call is an expression containing a simple type name and a parenthesized argument list. The argument list can contain any number of expressions separated by commas. It can also be empty.
For example: stub()overdue(account, date, amount)notify(name, date + 5)report(error, time, date, ++num)
There are two kinds of function calls: ordinary function calls and C++ member function calls. Any function may call itself except for the function main.

Type of a Function Call
The type of a function call expression is the return type of the function. This type can either be a complete type, a reference type, or the type void. A function call is an lvalue if and only if the type of the function is a reference.

Arguments and Parameters
A function argument is an expression that you use within the parentheses of a function call. A function parameter is an object or reference declared within the parentheses of a function declaration or definition. When you call a function, the arguments are evaluated, and each parameter is initialized with the value of the corresponding argument. The semantics of argument passing are identical to those of assignment.
A function can change the values of its non-const parameters, but these changes have no effect on the argument unless the parameter is a reference type.

Linkage and Function Calls
In C, if a function definition has external linkage and a return type of int, calls to the function can be made before it is explicitly declared because an implicit declaration of extern int func(); is assumed. This is not true for C++.

Type Conversions of Arguments
Arguments that are arrays or functions are converted to pointers before being passed as function arguments.
Arguments passed to nonprototyped C functions undergo conversions: type short or char parameters are converted to int, and float parameters to double. Use a cast expression for other conversions.
The compiler compares the data types provided by the calling function with the data types that the called function expects and performs necessary type conversions. For example, when function funct is called, argument f is converted to a double, and argument c is converted to an int: char * funct (double d, int i); /* ... */int main(void){ float f; char c; funct(f, c) /* f is converted to a double, c is converted to an int */ return 0;}
Evaluation Order of Arguments
The order in which arguments are evaluated is not specified. Avoid such calls as: method(sample1, batch.process--, batch.process);
In this example, batch.process-- might be evaluated last, causing the last two arguments to be passed with the same value.

Example of Function Calls
In the following example, main passes func two values: 5 and 7. The function func receives copies of these values and accesses them by the identifiers: a and b. The function func changes the value of a. When control passes back to main, the actual values of x and y are not changed. The called function func only receives copies of the values of x and y, not the variables themselves. /**** This example illustrates function calls**/#include void func (int a, int b){ a += b; printf("In func, a = %d b = %d\n", a, b);}int main(void){ int x = 5, y = 7; func(x, y); printf("In main, x = %d y = %d\n", x, y); return 0;}
This program produces the following output: In func, a = 12 b = 7In main, x = 5 y = 7

Sunday, November 16, 2008

Learnings (betinol)

November 10-14

We had an individual work this time!!

Seriously I really don't know how it works but I discovered it step by step through time.

Though my work is incomplete and misplaced some marks, but still learned.

The for Statement


- the for loop provides a compact syntax for iteration
- typically used for counting loops, but can be used for any loop
- allows you to specify the following all on one line
1) initialization statement(s)
2) Boolean expression for continuing loop
3) statements to be executed after loop

// for loop syntax
for ( initialization; Boolean expression ; increment )
{
statements to be repeated
}

// for loop example
for (Num = 0; Num < 10; Num = Num+1)
{
cout << Num << "cubed=" << Num*Num*Num << endl;
}

Saturday, November 15, 2008

LEARNINGS OF THE WEEK (Nov. 10-14)
By: Frea Diane T. Bautista

This week, we were given another activity to solve but this time, its an individual work.

Its just the same on our previous lessons but still it’s hard to execute the right usage of statements.

Just like Cielito, my program did run but still its wrong.

Better luck next time! HUHUHU

November 10 - 14, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal

It’s Activity Time…!

This week, we had an activity again about programming…

And the problem given to us was just parallel to those problems reported in the class the last day…

But even if it’s a parallel to some of the problem reported, it still takes us time to solve and answer the problem…

Like the previous activities, even though my program runs, I still ended up giving the wrong answer…

------------------------------------------------------------------------------------------------------------

..huhuhu..

hOw saD..(T_T)

Saturday, November 8, 2008

Learnings Lorebeth Betinol

Hey! its November...

We started the week with an assignment in programming about iterative statements.

Each of the group is task to report a problem.

This time I learned A lot.

I learned more about how important are the punctuations because it may affect the whole program.

Unluckily we are the first one to report but unluckily I'm no chosen..
LEARNINGS OF THE WEEK (Nov. 3-7)
By: Frea Diane T. Bautista

This is the start of our 3rd grading period!

This week, each group was assigned to execute and report their respective activities.

I learned something about how to use iterative statements because I was there when we were trying to execute the activity by ourselves. Its easy to execute but definitely hard to explain.

Unfortunately, when the reporting day came, I was the on who was told to help Lorebeth in reporting. Unluckily, we only got 85. Huhuhu

Learnings of the Week!! (Nov 3-7)

Steffany Queen P. Bigoy


Uhhm, this week?? We just have a reporting
assigned by our teacher.
And you know what, I was chosen as
a reporter, my God, its so difficult. Ü

But luckily, sir Balbuena let my group help me.
And we have done it. But its hard, really hard.!

November 3 - 7, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal

3rd grading has started…

We started the week with an assignment in programming about iterative statements.

Each group was given different problems that must be reported by group also the next day.

We we’re so nervous because we don’t know how to answer our problem. But thanks to our classmates, we solve our problem because of their help.

Luckily, I’m not the one who was chosen to report our problem…yipeey!!

-----------------------------------------------------------------------------------------------------------

‘yan lang!! (^_^)

Monday, November 3, 2008

Learnings of the Week (Oct 26-Nov.3)

By:Frea Diane T. Bautista

..uhhmmmm..it's our sembreak and it's the end of our 2nd grading period.

Friday, October 31, 2008

Learnings of the Week! (Sept. 29-Oct 31)

By: Steffany Queen P. Bigoy

This week, we have performed a series of activities, I admit that I haven’t perfect the scores but still I learned a lot of lessons. It is so useful and very important to us for our future.

Below, you will see how the user values were read.

Example:

#include
int main()
{
int a, b, c;
printf("Enter the first value:");
scanf("%d", &a);
printf("Enter the second value:");
scanf("%d", &b);
c = a + b;
printf("%d + %d = %d\n", a, b, c);
return 0;
}

Note that scanf uses the same sort of format string as printf (type man scanf for more info). Also note the & in front of a and b. This is the address operator in C: It returns the address of the variable (this will not make sense until we discuss pointers). You must use the & operator in scanf on any variable of type char, int, or float, as well as structure types (which we will get to shortly). If you leave out the & operator, you will get an error when you run the program. Try it so that you can see what that sort of run-time error looks like.

Let's look at some variations to understand printf completely. Here is the simplest printf statement:

printf("Hello");

This call to printf has a format string that tells printf to send the word "Hello" to standard out. Contrast it with this:

printf("Hello\n");

The difference between the two is that the second version sends the word "Hello" followed by a carriage return to standard out.

The following line shows how to output the value of a variable using printf.

printf("%d", b);

The %d is a placeholder that will be replaced by the value of the variable b when the printf statement is executed. Often, you will want to embed the value within some other words. One way to accomplish that is like this:

printf("The temperature is ");
printf("%d", b);
printf(" degrees\n");

An easier way is to say this:

printf("The temperature is %d degrees\n", b);

You can also use multiple %d placeholders in one printf statement:

printf("%d + %d = %d\n", a, b, c);

In the printf statement, it is extremely important that the number of operators in the format string corresponds exactly with the number and type of the variables following it. For example, if the format string contains three %d operators, then it must be followed by exactly three parameters and they must have the same types in the same order as those specified by the operators.

You can print all of the normal C types with printf by using different placeholders:

  • int (integer values) uses %d
  • float (floating point values) uses %f
  • char (single character values) uses %c
  • character strings (arrays of characters, discussed later) use %s

October 27 - 31, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal

seMbReak tYm!!!

8s the eNd of the 2nd Grading period…yaHoo!!

This week, I learned………nothing!!!..hehe,. rest time kasi na min ‘to..haha..

That’s aLL..Thank u!! (n_n)

Learnings of the week (Lorebeth)

October 27-31
by: Lorebeth Betinol


DRUM ROLL PLEASE...............................................................................................................................


I have Learned nothing because it is our semestral break, despite of having this break we are still busy with some projects.. That's all.. thank you.

wHEW!! iT SEEMS LIKE THIS ONE IS soooooooooooooooooooooooooooooooooo long..

Bye...

Saturday, October 25, 2008

Learnings of the week (Lorebeth)(Ocober 20-24)

This Week we are going to have our periodical test for the second quarter, so.... no serious class really happened.

Only the batch two had their activity about programming.
Learnings of the Week (Oct. 20-24)

By: Frea Diane T. Bautista

Ahmmm..this week, we just had a review. No new lessons have discussed. The Batch 2 had just perform an activity in the Computer Laboratory. And on 24 we had our 2nd Periodical Exam in TLE.

October 20 - 24, 2008

LEARNINGS OF THE WEEK
By: Cielito M. Cantero
IV – Rizal



Our Second Grading Examination was done this week last October 24 and the test was very hard for me specially the programming part. It takes a lot of time for me to answer it.

The day before the examination, we had an activity about programming. And again and again…I wasn’t able to solve the problem properly but I was able to run it.

We also had done the business planning this week. It really takes time and effort to make such project. And so teamwork and cooperation is a big help. Even though we had hard time to finish it, we still finished it and got high grades..hehe..

Saturday, October 18, 2008

Learnings of the Week(Oct.13-17)

By: Frea Diane T. Bautista

This week, we learned alot about looping and branching. We used it in some of our activities but what do looping and branching really mean.

For me, The for Statement

This is the famous for loop structure that many of you have been using to write your own algorithms. The for loop is used when the number of loops is known (unlike the while loop, as we will see later). The syntax of the for loop is:

for (initialization; conditional expression; stepping)
{
statement 1;
statement 2;
}

As you can see, the initialization, the expression that controls the loop, and the stepping parts are all defined in the top of the statement and in one location. The parts are also separated by semicolons, and you begin the looped statements, or the statements that will be executed in the loop, using a block ( { } ). The first part of the for statement is the initialization part; use this part to initialize the variables that will be used in the algorithm of the for loop. Note that these variables are allocated on the stack, and this part will be executed only one time, because it doesn't make any sense to declare and initialize the same variable with the same value each time in the loop.

The next part is the conditional expression, which determines whether the loop will be executed again or not. If the condition (something like i < myArray.Length) evaluated to false, control passes to the first statement after the for statement block. If the condition evaluated to true, the body of the for block (the controlled statements) will be executed.

The last part is the stepping part. Usually it will be a counter that will increment the variable that the conditional expression uses, because at some point we need the conditional expression to evaluate to false and terminate the execution of the for loop. Note that the stepping part executes after the controlled statements. That is, first the initialization part executes (one time only) and the variables allocate space on the stack; second, the conditional expression is evaluated, and if true, the controlled statements execute, followed by the stepping part execution, and again the conditional expression is evaluated and the process iterates.

Note that any of the three parts that make the for statement can be empty; although it's not common, it can happen. Take a look:

static void Main(string[] args)
{
int x = 10;
for(; x < 100; x += 10)
{
Console.WriteLine(x);
}
Console.ReadLine();
}

Compile the method into a class and run the application; you will get the following result:



As you can see, we omit the initialization part and we just put in the semicolon. Also note that the counter can increment or decrement, and it's up to you to define the algorithm.

The for loop can be used to define very complex algorithms; this happens as a result of nesting the for loops. Let's take a very simple example which extends the above loop example. It will simply write the same numbers, but this time with a little difference.

public class Loops
{
static void Main(string[] args)
{

for(int x = 10; x < 100; x += 10)
{
Console.WriteLine();
Console.WriteLine(x);
for(int y = x - 1, temp = x - 10; y > temp; y--)
{
Console.Write("{0}, ", y);
}
}
Console.ReadLine();
}
}

Compile the class and run it, and you will get the following result:



I have used a nest for loop to print all the numbers between two iterations from the outer for loop. The ability to use for loops actually makes great programmers.

LEARNINGS OF THE WEEK (Oct. 13 - Oct. 17)


LEARNINGS OF THE WEEK

By: Cielito M. Cantero

IV – Rizal

The branching and Looping!..

Branching and Looping

In C, both if statements and while loops rely on the idea of Boolean expressions. Here is a simple C program demonstrating an if statement:

#include 
 
int main()
{
int b;
printf("Enter a value:");
scanf("%d", &b);
if (b <>
printf("The value is negative\n");
return 0;
}

This program accepts a number from the user. It then tests the number using an if statement to see if it is less than 0. If it is, the program prints a message. Otherwise, the program is silent. The (b <> portion of the program is the Boolean expression. C evaluates this expression to decide whether or not to print the message. If the Boolean expression evaluates to True, then C executes the

single line immediately following the if statement (or a block of lines within braces imme

diately following the if statement). If the Boolean expression is False, then C skips the line or block of lines immediately following the if statement.



Here's slightly more comp

lex example:

#includ
e
 
int main()
{
int b;
printf("Enter a value:");
scanf("%d", &b);
if (b <>
printf("The value is negative\n");
else if (b == 0)
printf("The value is zero\n");
else
printf("The value is positive\n");
return 0;
}

In this example, the else if and else sections evaluate

for zero and positive values as well.

Here is a more complicated Boolean expression:

if ((x==y) && (j>k))
z=1;

else
q=10;

This statement says, "If the value in variable x equals the value in variable y, and if the value in variable j is greater than the value in variable k, then set the variable z to 1, otherwise set the variable q to 10." You will use if statements like this throughout your C programs to make decisions. In general, most of the decisions you

make will be simple ones like the first example; but on occasion, things get more complicated.

Notice that C uses == to test for equality, while it uses = to assign a value to a variable. The && in C represents a Boolean AND operation.

Here are all of the Boolean operators in C:

equality          ==

less than         <
Greater than      >
<=                <=
>=                >=
inequality        !=
and               &&
or                ||
not               !

You'll find that while statements are just as easy to use as if statements. For example:

while (a <>
{
printf("%d\n", a);
a = a + 1;
}

This causes the two lines within the braces to be executed repeatedly until a is greater than or equal to b. The while statement in general works like this:



C also provides a do-while structure:

do
{
printf("%d\n", a);
a = a + 1;
}
while (a <>

The for loop in C is simply a shorthand way of expressing a while statement. For example, suppose you have the following code in C:

x=1;
while (x<10)
{
blah blah blah
x++; /* x++ is the same as saying x=x+1 */
}

You can convert this into a for loop as follows:

for(x=1; x<10;>
{
blah blah blah
}

Note that the while loop contains an initialization step (x=1), a test step (x<10), and an increment step (x++). The for loop lets you put all three parts onto one line, but you can put anything into those three parts. For example, suppose you have the following loop:

a=1;
b=6;
while (a <>
{
a++;
printf("%d\n",a);
}

You can place this into a for statement as well:

for (a=1,b=6; a <>

It is slightly confusing, but it is possible. The comma operator lets you separate several different statements in the initialization and increment sections of the for loop (but not in the test section). Many C programmers like to pack a lot of information into a single line of C code; but a lot of people think it makes the code harder to understand, so they break it up.

= vs. == in Boolean expressions

The == sign is a problem in C because every now and then you may forget and type just = in a Boolean expression. This is an easy mistake to make, but to the compiler there is a very important difference. C will accept either = and == in a Boolean expression -- the behavior of the program changes remarkably between the two, however.

Boolean expressions evaluate to integers in C, and integers can be used inside of Boolean expressions. The integer value 0 in C is False, while any other integer value is True. The following is legal in C:

#include 
 
int main()
{
int a;
 
printf("Enter a number:");
scanf("%d", &a);
if (a)
{
printf("The value is True\n");
}
return 0;
}

If a is anything other than 0, the printf statement gets executed.

In C, a statement like if (a=b) means, "Assign b to a, and then test a for its Boolean value." So if a becomes 0, the if statement is False; otherwise, it is True. The value of a changes in the process. This is not the intended behavior if you meant to type == (although this feature is useful when used correctly), so be careful with your = and == usage.