Saturday, December 20, 2008

At last!

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

This week, we finally met with our teacher after several days of having no class. But we did not tackled any lesson. Instead, we had an activity about the reports of our classmates. As what we did not expect...It was hard but we managed to answer it though... oh! and one thing, we celebrated also our Christmas party...^^,

Learnings of the Week (ROLLORATA)

HAPPY HOLIDAYS! :))

wooh. i guess i really deserve this break.

time out for the (urgh) spellbinding programming lessons.

well, weeks from now, classes will again be resumed and hhhmm.. looking forward to recursion and arrays. haha.

merry xmas! wish Ü all the best this new year, Sir ernz. :]

Monday, December 15, 2008

Learnings of the Week (ROLLORATA)

CONDITIONAL STATEMENTS :]

A conditional statement is a set of commands that executes if a specified condition is true. JavaScript supports two conditional statements: if...else and switch.

if...else Statement

Use the if statement to execute a statement if a logical condition is true. Use the optional elseif statement looks as follows: clause to execute a statement if the condition is false. An

if (condition)
statement_1
[else
statement_2]

condition can be any expression that evaluates to true or false. If condition evaluates to true, statement_1 is executed; otherwise, statement_2 is executed. statement_1 and statement_2 can be any statement, including further nested if statements.

You may also compound the statements using else if to have multiple conditions tested in sequence, as follows:

if (condition)
statement_1
[else if (condition_2)
statement_2]
...
[else if (condition_n_1)
statement_n_1]
[else
statement_n]

To execute multiple statements, use a block statement ({ ... }) to group those statements. In general, it is a good practice to always use block statements, especially in code involving nested if statements:

if (condition) {
statements_1
} else {
statements_2
}

It is advisable to not use simple assignments in a conditional expression, because the assignment can be confused with equality when glancing over the code. For example, do not use the following code:

if (x = y) {
/* do the right thing */
}

If you need to use an assignment in a conditional expression, a common practice is to put additional parentheses around the assignment. For example:

if ((x = y)) {
/* do the right thing */
}

Do not confuse the primitive boolean values true and false with the true and false values of the Boolean object. Any value that is not undefined, null, 0, NaN, or the empty string (""), and any object, including a Boolean object whose value is false, evaluates to true when passed to a conditional statement. For example:

var b = new Boolean(false);
if (b) // this condition evaluates to true

Example
In the following example, the function checkData returns true if the number of characters in a Text object is three; otherwise, it displays an alert and returns false.

function checkData() {
if (document.form1.threeChar.value.length == 3) {
return true;
} else {
alert("Enter exactly three characters. " +
document.form1.threeChar.value + " is not valid.");
return false;
}
}

switch Statement

A switch statement allows a program to evaluate an expression and attempt to match the expression's value to a case label. If a match is found, the program executes the associated statement. A switch statement looks as follows:

switch (expression) {
case label_1:
statements_1
[break;]
case label_2:
statements_2
[break;]
...
default:
statements_def
[break;]
}

The program first looks for a case clause with a label matching the value of expression and then transfers control to that clause, executing the associated statements. If no matching label is found, the program looks for the optional default clause, and if found, transfers control to that clause, executing the associated statements. If no default clause is found, the program continues execution at the statement following the end of switch. By convention, the default clause is the last clause, but it does not need to be so.

The optional break statement associated with each case clause ensures that the program breaks out of switch once the matched statement is executed and continues execution at the statement following switch. If break is omitted, the program continues execution at the next statement in the switch statement.

Saturday, December 13, 2008

No Class pa rin!

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

This week, we had no class because the teachers again were so busy...But we were tasked by our teacher to study the reports of our classmates in our activity last week..And so I still learned a bit with the help of my classmates explaining it to me..That's all!^^,


Saturday, December 6, 2008

No Class...

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

This week, we still did not have a class with our teacher but we continued reporting our assignments in programming... ♪♪♪

Learnings of the Week (Rollorata)

Another HOLIDAY! hehe :)

this week was not that complicated because only few teachers went to our class to have their regular class discussion.

People were busy for the TEACHER'S DAY!

and Sir Ernie was one of the dancers of our school. Wooh. Yey! :]

maybe next week, we'll be back to torture, oh i mean, class again. hehe.


(",)

Saturday, November 29, 2008

hOliDAY!!!!=)

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

We had no class this week because the teachers and the students were too busy preparing for the press conference to be held in our school..And so we had no class for the rest of the day..That's all!

Learnings of the Week (Rollorata)

ANOTHER NO CLASS. :]

This week is totally mind-boggling and restless. joke!

Actually, we don't have our regular classes this week because teachers became busy preparing for the Regional Level Press Conference that will be held in our school.

Yet, because i knew i always had a hard time on creating simple programs, at home, i always practice and feel very happy whenever i can run a program correctly. Ü


Sunday, November 23, 2008

FuNctions in TLE???

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal


This week, we discussed about the function and function call. The function call is the one that calls the function in doing it's specified tasks. We also discussed about the actual and formal parameters. I also learned that the functions may be called by value or passed by value. We also had activities in programing.♫♪♫♪♫☻

Learnings of the Week (Rollorata)

FUNCTIONS IN MATH. FUNCTIONS IN.... TLE??

This week, we discussed about the function and function call.

The function call is the one that calls the function in doing it's specified tasks. We also discussed about the actual and formal parameters.

I also learned that the functions may be called by value or passed by value.

Simple programs involving these were also discussed.

Sunday, November 16, 2008

What a quiz!

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal


This week, we had a surprise quiz parallel to our activity last week. Although it was just parallel to our activity last week, it took time for us to figure out how to answer it. But in the end, I ended up giving the wrong program to run.. : (...

Learnings of the Week (Rollorata)

QUIZ TIME!

This time, i was still out because of the quiz bee i attended to. my classmates told me that they had a quiz that was parallel or similar with the problems they reported. Only few of them got the program right.

Saturday, November 8, 2008

Third gradinG na!!!

LEARNINGS OF THE WEEK
By: Sharra Mae S. Tagaro IV- Rizal


This week, we started our third grading with an assignment on programming, specifically on iterative statements which is to be reported the other day in a manila paper. I was so nervous because our problem is so difficult and there was only the two of us left to make the assignment and that we almost gave up. But because we tried our best and we asked the help of our subject teacher, we made it and I was able to present and explain it in front of the class.What a relief...
This was our assigned problem and answer:
Write a program that will display the following pattern, give the value of n.
So this was the program we run:
#include
#define p printf
#define s scanf
main()
{
int f,q,x,y,t;
clrscr();
p("Enter number:");
s("%d",&x);
p("If n=%d,output\n");
p("\n\n");
q=x;
f=1;
for(y=1,y<=x,y++)
{
for(t=f,t<=q,t++)
{
p("*");
}
p("\n");
q--;
}
getch();
}
The result of this program will look like this:

Enter number: 4

If n=4, output

****

***

**

*

Learnings of the Week (Rollorata)

THIRD QUARTER!

This week, i was out from the class because of an intensive review for the upcoming Regional Math Quiz Bee, yet, i still have the time to ask my classmates what they did in our Computer Class. They had their reporting on computer programming and i found the problems hard. our group's problem was to Write a program that will display the following pattern, give the value of n.

****

***

**

*

This was the program that we ran:

#include
#define p printf
#define s scanf
main()
{
int f,q,x,y,t;
clrscr();
p("Enter number:");
s("%d",&x);
p("If n=%d,output\n");
p("\n\n");
q=x;
f=1;
for(y=1,y<=x,y++)
{
for(t=f,t<=q,t++)
{
p("*");
}
p("\n");
q--;
}
getch();
}

The result of this program will look like this:

Enter number: 4

If n=4, output

****

***

**

*

Sunday, October 26, 2008

LEARNINGS OF THE WEEK (TAGARO)

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

We had our second grading examination last October 24. And I'm not confident that I will gain a high score because there were items in the test that I had a difficult time answering.

Before the day of our examination, we had an activity about programming. I was able to run my program but I was not able to get the perfect score in the rubrics because the answer of my program is incorrect.What a pity..

Saturday, October 25, 2008

Learnings of the Week (ROLLORATA)

This week, we started making our business plan.It really takes time and effort to make such. And so teamwork and cooperation is a big help.
That's all!

Sunday, October 19, 2008

Learnings of the Week (ROLLORATA)

ITERATIVE STATEMENTS

Iterative statements (loops) allow a set of instruction to be executed or performed several until condition are met. It can be predefined as in the loop, or open ended as in while and do-while.

Types of Iterative Statements

The For statements

The While statements

The Do-While statements

The For statements

The For statement or for loop is considered as a predefined loop because the number or times it iterates to perform its body is predetermined in the loop’s definition.

The For loop contains a counter whose values determine the number of times the loop iterates. The iteration stops upon reaching the number of times specified in the loop.

The general form of the for statement is:

for (initialization; condition; increment)
{
statement_sequence;
}

Where:
l for is a reserve word in C
l Initialization is an assignment statement that is used to set the loop’s counter.
l Condition is a relational boolean expression that determines when the loop will exit.
l Increment defines how the loop’s counter will change each time the loop is separated.
l Statement sequence may either be a single C statement or a block of C statements that make up the loop body.

l The for loop continues to execute until the condition is True (1).
l Once False (0), program execution resumes on the statement following the for loop.

Note:
l Never place a semicolon right after the for header.
l Never change the value of the for loop’s counter in side the body of the loop. This will affect the result of the program.
l The increment part of the for loop is execute after the first iteration of the loop.

The While statement

The while statement or while loop is an open-ended or event-controlled loop.
The while loop iterates while the condition is TRUE (1).
When it becomes FALSE (0), the program control passes to the line after the loop code.

The general form of the while statement is:

while (condition)
{
statement_sequence;
}

where:
l While is a reserved word in C
l Condition is a relational expression that determines when the loop will exit.
l Statement_sequence may either be a single C statement or a block of C statements that make up the loop body.

The Do-While statement

The second type of open-ended or event-controlled loop is the do-while statement or do-while loop.
The general form of the do-while statement is:
do
{
statement_sequence;
} while (condition);

Where:
l While and do are reserved words in C
l Condition is a relational expression that determines when the loop will exit.
l Statement_sequence may either be a single C statement or a block C statements that make up the loop body.

Do-While is a variation of the while statement which checks the condition at the bottom / end of the loop.
This means that a do-while loop “always executes at least once”.
In the do-while loop, when the condition evaluates to TRUE (1), the loop body will be executed, but when FALSE (0), program control proceeds to the next instruction after the do-while loop.

Saturday, October 18, 2008

LEARNINGS OF THE WEEK (TAGARO)

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

ITERATIVE STATEMENTS
Iterative statements (loops)- allow a set of instruction to be executed or performed several times until conditions are met.
Types of Iterative Statements
☺The For statements
☺The While statements
☺The Do-While statements

☻The For statements
- considered as a predefined loop because the number or times it iterates to perform its body is predetermined in the loop’s definition.
- The For loop contains a counter whose values determine the number of times the loop iterates. The iteration stops upon reaching the number of times specified in the loop.
The general form of the for statement is:
for (initialization; condition; increment)
{
statement_sequence;
}
Where:
*for is a reserve word in C
*Initialization is an assignment statement that is used to set the loop’s counter.
*Condition is a relational boolean expression that determines when the loop will exit.
*Increment defines how the loop’s counter will change each time the loop is separated.
*Statement sequence may either be a single C statement or a block of C statements that make up the loop body.
-The for loop continues to execute until the condition is True (1).
-Once False (0), program execution resumes on the statement following the for loop.
Note:
*Never place a semicolon right after the for header.
*Never change the value of the for loop’s counter in side the body of the loop. This will affect the result of the program.
*The increment part of the for loop is execute after the first iteration of the loop.

☻The While statement
- an open-ended or event-controlled loop.
-The while loop iterates while the condition is TRUE (1). When it becomes FALSE (0), the program control passes to the line after the loop code.
The general form of the while statement is:
while (condition)
{
statement_sequence;
}
Where:
*While is a reserved word in C
*Condition is a relational expression that determines when the loop will exit.
*Statement_sequence may either be a single C statement or a block of C statements that make up the loop body.

☻The Do-While statement

- The second type of open-ended or event-controlled loop.
The general form of the do-while statement is:
do
{
statement_sequence;
} while (condition);
Where:
*While and do are reserved words in C
*Condition is a relational expression that determines when the loop will exit.
*Statement_sequence may either be a single C statement or a block C statements that make up the loop body.
- a variation of the while statement which checks the condition at the bottom / end of the loop. This means that a do-while loop “always executes at least once”.
- when the condition evaluates to TRUE (1), the loop body will be executed, but when FALSE (0), program control proceeds to the next instruction after the do-while loop.

LEARNINGS OF THE WEEK (TAGARO)

LEARNINGS OF THE WEEK
By: Sharra Mae S. Tagaro IV- Rizal

Second grading is almost up! Next week we will have our second grading examination.
This week, we continued making our business plan and we learned so much from it. We now experienced how to be an entrepreneur. And it is quite an experience.
We still did have activities in programming and even I did not get perfect in the rubrics. I still feel happy because I tried and I learned from my mistakes. And I hope I will not get the same mistakes again.

Learnings of the Week (ROLLORATA)

Second grading is almost up! Next week we will have our second grading examination.
This week, we continued making our business plan and we learned so much from it.

We now experienced how to be an entrepreneur. And it is quite a great one.

We still did have activities in programming and even I did not get perfect in the rubrics. I still feel happy because I tried and I learned from my mistakes. And I hope I will not get the same mistakes again.

Tuesday, October 14, 2008

Learnings of the Week (ROLLORATA)

Conditional Statement

Are statements that check an expression then may or may not execute a statement or group of statement depending on the result of the condition.

Types of Conditional Statement

The If Statement
The If-Else Statement
The Nested-If Statement
The If-Else-If Ladder
The Switch Statement
The Nested Switch Statement

The If Statement

The general form of the If statement is:
if ( expression)
statement;

Expression is relational or Boolean expression that evaluates to a TRUE (1) or False (0) value.
Statement may either be a single C statement or a block of C statements.

The general form of the If statement with block statement is:
if ( expression)
{
statement_sequence;
}

In an if statement, if the expression evaluates to TRUE (1), the statement or the block of statements that forms the target of the if statement will be executed. Otherwise, the program will ignore the statement or the block of statements.

The If-Else statement

The general form of the if-else statement is:
If (expression)
statement_1;
else
statement_2;

Where:
– If and else are reserved words
– Expression is relational or Boolean expression that evaluates to a TRUE (1) or False (0) value.
– Statement_1 and statement_2 may either be a single C statement or a block of c statements.

If an if-else statement, if the expression is TRUE (1), the statement or block of statement after the if statement will be executed; otherwise, the statement or block of statement in the else statement will be executed.
Note: Only the code associated with the if or the code that is associated with the else executes, never both.

Nested-If statement
One of the most confusing aspects of the if statement in any programming language is nested ifs. A nested if is an if statement that is the object of either an if or else.
This is sometimes referred to as “an if within an if.”
The reason that nested ifs are so confusing is that it can be difficult to know what else associates with what if.
Fortunately, C provides a very simple rule for resolving this type of situation.
In C, the else is linked to the closest preceding if that does not already have an else statement associated with it.

The if-else-if Ladder
A common programming construct in C is the if-else- if ladder.

In an if-else-if ladder statement, the expression are evaluated from the top downward.
As soon as a true condition is found, the statement associated with it is executed and the rest of the ladder will not be executed. If none of the condition is true, the final else is executed.
The final else acts as a defaults condition. If all other conditions are false, the last else statement is performed.
If the final else is not present, then no action takes place.
Note: The final else is optional, you may include this part if needed in the program or you may not include if not needed.

The switch statement
The switch statement is a multiple-branch decision statement.
In a switch statement, a variable is successively tested against a list or integer or character constants.
If a match is found, a statement or block of statement is executed.
The default part of the switch is executed if no matches are found.
According to Herbert Schildt (1992), there are three important things to know about switch statements:
l 1. The switch differs from if statements in such a way that switch can only test fro equality whereas if can evaluate a relational or logical expression.
l 2. No two case constants in the same switch can have identical values. Of course, a switch statement enclosed by an outer switch may have case constant that are the same.
l 3. If character constants are used in the switch, they are automatically converted to their integer values.

Note: The break statement is used to terminate the statement associated with each case constant. It is a C keyword which means that at that point of execution, you should jump to the end of the switch statement by the symbol }.

Sunday, October 12, 2008

Learnings of the Week (ROLLORATA)

This week, we started making our business plan.It really takes time and effort to make such. And so teamwork and cooperation is a big help.
That's all!

Saturday, October 11, 2008

LAERNINGS OF THE WEEK (TAGARO)

LEARNINGS OF THE WEEK
By: Sharra Mae S. Tagaro IV- Rizal

☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺
This week, we started making our business plan.It really takes time and effort to make such.And so teamwork and cooperation is a big help.
That's all!
☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺☻☺

Saturday, October 4, 2008

LEARNINGS OF THE WEEK (TAGARO)

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal

♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫

This week, we did not have any class because of school activities. Thats all!

♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪
-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫-♪-♫

Saturday, September 27, 2008

LEARNINGS OF THE WEEK (TAGARO)

LEARNINGS OF THE WEEK
BY: Sharra Mae S. Tagaro IV- Rizal
Conditional Statements
-Are statements that check an expression then may or may not execute a statement or group of statement depending on the result of the condition.

Types of Conditional Statement
1.)The If Statement
2.)The If-Else Statement
3.)The Nested-If Statement
4.)The If-Else-If Ladder
5.)The Switch Statement
6.)The Nested Switch Statement

1.)The If Statement
l*The general form of the If statement is:
if ( expression)
statement;
-Expression is relational or Boolean expression that evaluates to a TRUE (1) or False (0) value.
- Statement may either be a single C statement or a block of C statements.
*
The general form of the If statement with block statement is:
if ( expression)
{
statement_sequence;
}
-In an if statement, if the expression evaluates to TRUE (1), the statement or the block of statements that forms the target of the if statement will be executed. Otherwise, the program will ignore the statement or the block of statements.

l
2.) The If-Else statement
*The general form of the if-else statement is:
If (expression)
statement_1;
else
statement_2;
l-Where:
If and else are reserved words.
Expression is relational or Boolean expression that evaluates to a TRUE (1) or False (0) value.
Statement_1 and statement_2 may either be a single C statement or a block of C statements.
l*The general form of the if-else statement with block of statement is:
If (expression)
{ statement_sequence;
}
else
{
statement_sequence;
}
l-If an if-else statement, if the expression is TRUE (1), the statement or block of statement after the if statement will be executed; otherwise, the statement or block of statement in the else statement will be executed.
lNote: Only the code associated with the if or the code that is associated with the else
executes,
never both.
l

3.)Nested-If statement
-One of the most confusing aspects of the if statement in any programming language is nested ifs. A nested if is an if statement that is the object of either an if or else.
l-This is sometimes referred to as “an if within an if.”
l-The reason that nested ifs are so confusing is that it can be difficult to know what else associates with what if.
-In C, the else is linked to the closest preceding if that does not already have an else statement associated with it.
l*Consider the following situations:
Situations 1. The else at number 3 is paired with the if in number 2 since it is the nearest if statement with the else statement.
l1. if…..
l2. if ……
l3. else
Situations 2. The else in number 5 is paired with the if in number 1.
l1. if ….
l2. {
l3. if ….
l4. }
l5. else
l-Note that there is a pair of braces found in number 2 and number 4.
l-The pair of braces defined the scope of the if statement in number 1 starting from the { in number 2 and ends with } in number 4.
l-Therefore, the else statement in number 5 cannot paired with the if statement in number 3 because the else statement is outside the scope of the first if statement.
l-This makes the if statement in number 1 the nearest if statement to the else statement in
number 5.

4.)The if-else-if Ladder
l-A common programming construct in C is the if-else- if ladder.
l*The general form of the if-else-if ladder statement is:
if ( expression_1)
statement_1;
else if (expression_2)
statement_2;
else if (expression_3;
statement_3;
:
:
else
statement_else;
l-Where:
If and else are reserve words in C
Expression_1, expression_2 up to expression_n in relational or boolean expression that evaluates to a TRUE (1) or False (0) value.
Statement_1, statement_2 up to statement_else may either be a single C statement or a block
of C statement.
l-In an if-else-if ladder statement, the expression are evaluated from the top downward.
l-As soon as a true condition is found, the statement associated with it is executed and the rest of
lthe ladder will not be executed. If none of the condition is true, the final else is executed.
l-The final else acts as a defaults condition. If all other conditions are false, the last else
statement is performed.
l-If the final else is not present, then no action takes place.
lNote: The final else is optional, you may include this part if needed in the program or you may
not include if not needed.

5.)The switch statement
l-The switch statement is a multiple-branch decision statement.
l*The general form of the switch statement is:
switch (variable)
{
case constant1:
statement sequence_1;
break;
case constant2:
statement_sequence_2;
break;
:
:
default:
statement_sequence_default;
}
l-In a switch statement, a variable is successively tested against a list or integer or character
constants.
l-If a match is found, a statement or block of statement is executed.
l-The default part of the switch is executed if no matches are found.
l-According to Herbert Schildt (1992), there are three important things to know about switch
statements:
1. The switch differs from if statements in such a way that switch can only test fro equality whereas if can evaluate a relational or logical expression.
2. No two case constants in the same switch can have identical values. Of course, a switch statement enclosed by an outer switch may have case constant that are the same.
3. If character constants are used in the switch, they are automatically converted to their integer values.
Note: The break statement is used to terminate the statement associated with each case constant. It is a C keyword which means that at the point of execution, you should jump to the end of the switch statement by the symbol }.


6.)The Nested Switch Statement
*The general form of the nested switch statement is:
switch (variable)
{
case constant:{
switch (variable)
{
case constant1:
statement sequence_1;
break;
case constant2:
statement_sequence_2;
break;
}
break;
}
case constant2:
statement sequence;
break;
default:
statement sequence;
}

Saturday, September 20, 2008

LEARNINGS OF THE WEEK (TAGARO)

STRUCTURE OF A SIMPLE C PROGRAM
BY: Sharra Mae S. Tagaro IV- Rizal


This week, we discussed more about C language- specifically its structure.

Structure of a simple C program
#include
#define directive
main()
{
variable declaration section;
______________________
______________________
}
  • n#include directive – contains information needed by the program to ensure the correct operation of C’s Standard library functions.
  • n#define directive – used to shorten the keywords in the program.
  • nVariable declaration section – it is the place where you declare your
variables.
  • nBody of the program – start by typing main() and the { and }. All statements
should be written inside the braces.
Commonly used include files in C language.
  • nalloc.h – declares memory management functions.
  • nconio.h – declares various functions used in calling IBM-PC ROM BIOS.
  • nctype.h – contains information used by the calssification and character convertion macros.
  • nmath.h – declares prototype for the math functions.
  • nstdio.h – defines types and macros needed for standard I/O.
  • nstring.h – declares several string manipulation and memory manipulation routines.
Important Symbols
  • n\n – is a line char used to move the cursor to the next line
  • n‘ ‘ – single quote is used for single character / letter.
  • n“ “ – double quote is used for two or more character
  • n{ - open curly brace signifies begin
  • n} – close curly brace signifies end
  • n& - address of operator
  • n* - indirection operator / pointer


LEARNINGS OF THE WEEK (TAGARO)

INPUT AND OUTPUT STATEMENTS
BY: Sharra Mae S. Tagaro IV- Rizal
Input Statement
A statement used to input a single character or a sequence of characters from the keyboard.
Types of Input Statement

1.)getch
-A function used to input a single character from the keyboard without echoing the character on the monitor.
Syntax: getch();
o2.)getche
o-A function used to input a single character from the keyboard, the character pressed echoed on the monitor, line the READLN in PASCAL
oSyntax: getche();
o3.)getchar
o-A function used to input a single character from the keyboard, the character pressed echoed on the monitor terminated by pressing Enter key.
oSyntax: getchar();
o4.)gets
o-A function used to input a single character from the keyboard, spaces are accepted, terminated by pressing enter key.
oSyntax: gets();
o5.)scanf
oA function used to input a single character or sequence of characters from the keyboard, it needs the control string codes in able to recognized. Spaces are not accepted upon inputting. Terminated by pressing space bar.
oSyntax: gets();

Output Statement
A statement used to display the argument list or string on the monitor.
Types of Output Statement
1.)printf
-A function used to display the argument list on the monitor.
It sometimes needs the control string codes to help display the remaining argument on the screen.
Syntax: printf(“control string codes”, argument list)
o2.)putchar
o-A function used to display the argument list or string on the monitor. It is like overwriting a character.
oSyntax: putchar();
o3.)puts
o-A function used to display the argument list or string on the monitor. It does not need the help of the control string codes.
oSyntax: puts();

Format String and Escape Sequence
Format Specifiers
o-All format specifiers start with a percent sign (%) and are followed by a single letter indicating the type of data and how data are to be formatted.
List of Commonly Used format specifiers
1.)%c – used for single char in C
2.)%d – decimal number (whole number)
o3.)%e – scientific notation / exponential form
o
o
o4.)%f – number with floating or decimal point
o
o5.)%o – octal number
o
o
o6.)%s– string of characters
7.)%u – unsigned number
8.)%x– hexadecimal numbers
9.)%X – capital number for hexadecimal number
10.)%%– print a percent sign
List of Commonly used escape sequence
\\ - prints backslash
\’ – prints single quotes
\” – prints double quotes
\? – prints question mark
\n - newline
Gotoxy
-A function gotoxy is used to send the cursor to the specified location.
Syntax: gotoxy(x,y);
Example: gotoxy(5,10);
Inserting Comment
/*y is assigned a numeric literal*/
Assignment Statement
-It stores a value or a computational result in a variable. They are commonly used to perform most arithmetic operations in a program. It can also be used in printf() statement.
Syntax: variable = expression
Example: y=1;
Note:
A format specifier %.2f can be used to limit the output being displayed into two decimal places only.