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.