Monday, December 7, 2009
Learnings Dec. 1- Jan.5 (lorebeth betinol)
But some of our classmates is task to report about iterative statements..
Here....
Iterative StatementsIterative statements, commonly referred to as looping statements, involve executing a series of statements zero or more times. We will discuss two specific shell looping statements, the while loop and the for loop.
The while loop executes the statement block enclosed within zero or more times as long as the boolean condition (or command) evaluates to TRUE (which again means returns a zero exit status). The general syntax of the while loop is: while boolean_condition
do
statement
optional statement(s)
done
As with the if-then statement, the boolean_condition is usually (but not always) evaluated using the test command. Note also that the body of the while is enclosed with the do-done statements. Thus if we wanted to find a sum of the numbers between 1 and 5, we could do this with the following while loop: COUNT=1
SUM=0
while [ "$COUNT" -le 5 ]
do
SUM=`expr $SUM + $COUNT` # or SUM=$(( SUM + COUNT ))
COUNT=`expr $COUNT + 1`
done
Note the double quotes surrounding the COUNT variable; these are to make sure this variable is seen by test, even if it has no value, to avoid any errors (as described above). Always keep in mind when coding looping statements that a condition must occur to terminate the loop, otherwise an infinite looping condition occurs. Incrementing the variable COUNT by 1 in this cases causes the value of COUNT to eventually reach 6 causing the loop to terminate. As with the if-then scenario described above, the while-do structure can be written as follows if desired: while [ "$COUNT" -le 5 ] ; do Another looping statement worth of discussion here is the for statement. While many modern languages have for statements, the for statement in the shell is a little different. The general syntax is as follows: for VARIABLE in list
do
statement
optional statement(s)
done
Unlike the while statement, a for statement doesn't terminate based upon a condition, rather it terminates when all items in the list have been "processed." The concept of a list was first introduced with the discussion regarding special environment variables. A list is a grouping of data items, sometimes referred to as words, since they are separated by spaces. A list may have zero items, a few items, or a large number of items. A list (with more than one item) will have a beginning item (the leftmost) and an ending item (the rightmost). The items in the list can be strings, variables, files, etc.
When a for loop executes for the first time, the VARIABLE will be assigned the first (leftmost) item in the list. During each subsequent iteration of the loop, the variable will be assigned the next item in the list. Thus when all items in the list have been assigned to the variable, the loop terminates. Refer to the following example: The variable name in this example is VALUE, and the list is composed of the 3 items (or words) "fred", "barney", and "dino." Thus when this loop executes, the following is the output: VALUE: fred VALUE: barney VALUE: dinoNotice there are 3 items in the list and the body of the loop executes 3 times. Thus for a list of size n, the body of a for loop will execute n times. Lists in for loops can be specified a number of ways, for example:
list
represents
item1 item2 ... itemn
a list of n items
$1 $2 $3
a list of 3 command line parameters
$*
a list of all command line parameters
*
a list of all files in current directory
a*
a list of all files starting with the letter aFor loops are typically used to process a quantity of things, for example, renaming all of the files in a directory by appending an extension of .backup (to indicate a backup copy) to their filename. As with the other scenarios described above, the for can be written as follows if one prefers: for VARIABLE in list ; do
Saturday, February 28, 2009
By: Frea Diane T. Bautista
This week, we were told about our new projects to be done. Group 6-10 were assigned to make an HTML about TCNHS(Tagum City National High School), while, WE,
Group 1-5 were assigned to make a program interfacing AC Load, Push Buttons and LED. Fortunately, some of the Group 1-4 members are helping us in making our assigned project about interfacing wth LED. However, Sir Ernie is checking the progress of our project everyday.
February 23 - 27, 2009
By: Cielito M. Cantero
IV - Rizal
This week, all the groups from group 1 to 10 were given all the time to finish there projects.
Also this week, Sir Ernie was always checking every progress and improvement in our project.
Eventhough making our project was very hard, we were still thankful because some of the groups (group 1 - 4) were helping us to do our task well.
Through this project, I learned many things about parallel port and its use in many fields.
We all hope that we will be able to accomplish the work that will give us great score!
Good Luck To Us!!!
-------------------------------------------------------------------------------------
ui sir!
ayo na baya amu blog..
dpat iAdd nimu amo grade sa blog sa 3rd grading sa grade namu sa 4th grading...
hehe,. atik lang Sir..
gmay ra jud bya amu grade sa 3rd grading Sir,.
murag kami na grupo ang pinakalowest...
huhuhu..
T_T
Sunday, February 22, 2009
Learnings (betinol)
From group 1-5 it will be all about programming, and the rest will be html making.
Our group is task to do a Program which is interfacing LED.
It is hard we know but we have to try inorder for us to learn.
Saturday, February 21, 2009
By: Frea Diane T. Bauista
This week, we just continued finishing our new activity about CSS. In making our CSS, we used the Frameset. But what is Frameset?
The FRAMESET element is a frame container for dividing a window into rectangular subspaces called frames. In a Frameset document, the outermost FRAMESET element takes the place of BODY and immediately follows the HEAD.
The FRAMESET element contains one or more FRAMESET or FRAME elements, along with an optional NOFRAMES element to provide alternate content for browsers that do not support frames or have frames disabled. A meaningful NOFRAMES element should always be provided and should at the very least contain links to the main frame or frames.
The ROWS and COLS attributes define the dimensions of each frame in the set. Each attribute takes a comma-separated list of lengths, specified in pixels, as a percentage, or as a relative length. A relative length is expressed as i* where i is an integer. For example, a frameset defined with ROWS="3*,*" (* is equivalent to 1*) will have its first row allotted three times the height of the second row.
The values specified for the ROWS attribute give the height of each row, from top to bottom. The COLS attribute gives the width of each column from left to right. If ROWS or COLS is omitted, the implied value for the attribute is 100%. If both attributes are specified, a grid is defined and filled left-to-right then top-to-bottom.
The FRAMESET element also accepts ONLOAD and ONUNLOAD attributes to specify client-side scripting actions to perform when the frames have all been loaded or removed.
February 16 - 20, 2009
By: Cielito M. Cantero
IV - Rizal
After programming, html, css, and etc..
This week, we were task to make our project to be passed before the finals
and this project will serve as our 4th grading project!
This project is all about the Parallel Port Interface for Groups 1 to 5 and HTML again for Groups 6 to 10..
By the way, do you know what parallel port interfacing is??
For you to know, read the following below...:
Parallel Port??
Parallel port is a simple and inexpensive tool for building computer controlled devices and projects. The simplicity and ease of programming makes parallel port popular in electronics hobbyist world. The parallel port is often used in Computer controlled robots, Atmel/PIC programmers, home automation, ...etc... Here a simple tutorial on parallel port interfacing and programming with some examples.
Everybody knows what is parallel port, where it can be found, and for what it is being used. the primary use of parallel port is to connect printers to computer and is specifically designed for this purpose. Thus it is often called as printer Port or Centronics port (this name came from a popular printer manufacturing company 'Centronics' who devised some standards for parallel port). You can see the parallel port connector in the rear panel of your PC. It is a 25 pin female (DB25) connector (to which printer is connected). On almost all the PCs only one parallel port is present, but you can add more by buying and inserting ISA/PCI parallel port cards.
Parallel port modes
The IEEE 1284 Standard which has been published in 1994 defines five modes of data transfer for parallel port. They are,
1) Compatibility Mode
2) Nibble Mode
3) Byte Mode
4) EPP
5) ECP
The programs, circuits and other information found in this tutorial are compatible to almost all types of parallel ports and can be used without any problems
Hardware: Parallel Port
The lines in DB25 connector are divided in to three groups, they are
1) Data lines (data bus)
2) Control lines
3) Status lines
As the name refers , data is transferred over data lines , Control lines are used to control the peripheral and of course , the peripheral returns status signals back computer through Status lines. These lines are connected to Data, Control And Status registers internally .
Parallel port registers
As you know, the Data, Control and status lines are connected to there corresponding registers inside the computer. So by manipulating these registers in program , one can easily read or write to parallel port with programming languages like 'C' and BASIC.
The registers found in standard parallel port are:
1) data register
2) Status register
3) Control register
As there names specifies, Data register is connected to Data lines, Control register is connected to control lines and Status register is connected to Status lines. (Here the word connection does not mean that there is some physical connection between data/control/status lines. The registers are virtually connected to the corresponding lines.). So what ever you write to these registers , will appear in corresponding lines as voltages, Of course, you can measure it with a multimeter. And What ever you give to Parallel port as voltages can be read from these registers(with some restrictions). For example , if we write '1' to Data register , the line Data0 will be driven to +5v. Just like this ,we can programmatically turn on and off any of the data lines and Control lines.
Where these registers are ?
In an IBM PC, these registers are IO mapped and will have unique address. We have to find these addresses to work with parallel port. For a typical PC , the base address of LPT1 is 0x378 and of LPT2 is 0x278. The data register resides at this base address , status register at baseaddress + 1 and the control register is at baseaddress + 2. So once we have the base address , we can calculate the address of each registers in this manner. The table below shows the register addresses of LPT1 and LPT2.
Programming Concepts
Almost all programming languages allow programmers to access parallel port using some library functions. For example , Borland C is providing "Inportb" and "Outportb" functions to read or write IO mapped peripherals. But the examples provided here in this tutorial is written VC++ and can be easily ported to other compilers like Borland C and Turbo C. Visual Basic does not have any functions or support to access parallel port directly, but it is possible to add such capabilities to your VB application by writing a dll in VC++ and calling its exported functions from VB. VC++ provides two functions to access IO mapped peripherals, '_inp' for reading and '_outp' for writing. These functions are declared in "conio.h".
How to Test The Program ?
Connect The assembled hardware shown above to your PC's parallel port. Open DOS command window Move to "C:\" and type "partest1 write 888 255" and press enter. If everything is correct , LED1 to LED8 in the hardware will glow. You may be doubtful about the command line parameters passed to the program. Here 888(0x378) is the address of the parallel port data register and 255 is the data to be written to parallel port data register. if you enter "partest1 read 888" to command line , the program will read parallel port data register and display it. This will blindly read the contents of parallel port data register , but not the data present on data lines. To read the data from the data lines , we will have to enable the bidirectional data transfer first. To enable Bidirectional data transfer just set the "Bidirectional" bit (bit 5) in control register. This is done by writing 32 to control register. The command "partest1 write 890 32" will do this. After entering this command you can read the status of switches in the hardware using the command "partest1 read 888"
NOTE: This sample program will not work on Windows NT/2000 or XP if you run the program on these machines , it will show an error. use new Inpout32.dll on NT/2000/XP machines
Me??
I belong to Group 5 and task to make a parallel port interface with LED or Light Emitting Diodes..
This project seems to be very hard for us especially because all of my groupmates
are girls and no one know how to do it well...
Even though Sir Ernie taught us already using some presentations, it's still
hard for us to do it right..
But we are still doing our best and hoping to have a good outcome...
That's All.
And good luck to us.
-------------------------------------------------------------------------------------
miskan baratuhon lang mga materials nOh, lisod man pud au..
huhuhu..
electric na man gud ni xa..
hehe,.
:]
Sunday, February 15, 2009
February 9 - 13, 2009
By: Cielito M. Cantero
IV - Rizal
This week, we are on HTML again...
But this second time around, we will do it with CSS or what we call as Cascading Style Sheet and Frames.
By the way, what do we mean by this things?? ahmm.. Well,
CSS or Cascading Style Sheet and Frames
There are two kinds of Style sheets the external and internal style sheet:
♥External Style Sheet
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the tag. The ‹link› goes inside the head section.
♥Internal Style Sheet
An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section with the ‹style› ‹link› tag.
Frames
In HTML, frames enable you present multiple HTML documents within the same window. For example, you can have a left frame for navigation and a right frame for the main content.
Frames are achieved by creating a frameset page, and defining each frame from within that page. This frameset page doesn't actually contain any content - just a reference to each frame. The HTML frame tag is used to specify each frame within the frameset. All frame tags are nested with a frameset tag.
Making HTML with CSS is also fun but so confusing...
You know, CSS is different from HTML..
That's why I'm confused..
That's All.
The week is over now.
-------------------------------------------------------------------------------------
suko na pud blik aq papa kay gabie au ko uwi..
kinsa man gud dli magab-ihan na alangan ugma na dayon ipasa ang HTML with CSS??
ata au..
saba man mi bah..
huhuhu..
hapit na gud 2 hating-gabi ng nakauwi me tanan..
may gneh daghan me..
pero dako au aq byad sa time ouie..
sagdi lang.. that's part of schooling.
hehe,.
hay!! humana na jud..
learnings of the week (lorebeth)
Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. Tutorials, books, mailing lists for users, etc. can be found on the “learning CSS” page. For background information on style sheets, see the Web style sheets page. Discussions about CSS are carried out on the (archived) www-style@w3.org mailing list (and sometimes on the CSS blog) and on comp.infosystems.www.authoring.stylesheets.
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in a markup language. Its most common application is to style web pages written in HTML and XHTML, but the language can be applied to any kind of XML document, including SVG and XUL.
CSS can be used locally by the readers of web pages to define colors, fonts, layout, and other aspects of document presentation. It is designed primarily to enable the separation of document content (written in HTML or a similar markup language) from document presentation (written in CSS). This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, and reduce complexity and repetition in the structural content (such as by allowing for tableless web design). CSS can also allow the same markup page to be presented in different styles for different rendering methods, such as on-screen, in print, by voice (when read out by a speech-based browser or screen reader) and on Braille-based, tactile devices. CSS specifies a priority scheme to determine which style rules apply if more than one rule matches against a particular element. In this so-called cascade, priorities or weights are calculated and assigned to rules, so that the results are predictable.
Use of CSS
Prior to CSS, nearly all of the presentational attributes of HTML documents were contained within the HTML markup; all font colors, background styles, element alignments, borders and sizes had to be explicitly described, often repeatedly, within the HTML. CSS allows authors to move much of that information to a separate stylesheet resulting in considerably simpler HTML markup.
Headings (h1 elements), sub-headings (h2), sub-sub-headings (h3), etc., are defined structurally using HTML. In print and on the screen, choice of font, size, color and emphasis for these elements is presentational.
Prior to CSS, document authors who wanted to assign such typographic characteristics to, say, all h2 headings had to use the HTML font and other presentational elements for each occurrence of that heading type. The additional presentational markup in the HTML made documents more complex, and generally more difficult to maintain. In CSS, presentation is separated from structure. In print, CSS can define color, font, text alignment, size, borders, spacing, layout and many other typographic characteristics. It can do so independently for on-screen and printed views. CSS also defines non-visual styles such as the speed and emphasis with which text is read out by aural text readers. The W3C now considers the advantages of CSS for defining all aspects of the presentation of HTML pages to be superior to other methods. It has therefore deprecated the use of all the original presentational HTML markup.
Friday, February 13, 2009
By: Frea Diane T. Bautista
This week, we had a new lesson. And Sir Ernie taught us a new lesson about CSS.
But what does CSS really mean?
* CSS stands for Cascading Style Sheets
* Styles define how to display HTML elements
* Styles are normally stored in Style Sheets
* Styles were added to HTML 4.0 to solve a problem
* External Style Sheets can save you a lot of work
* External Style Sheets are stored in CSS files
* Multiple style definitions will cascade into one
Style Sheets Can Save a Lot of Work
Styles sheets define HOW HTML elements are to be displayed, just like the font tag and the color attribute in HTML 3.2. Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in your Web, just by editing one single CSS document!
CSS is a breakthrough in Web design because it allows developers to control the style and layout of multiple Web pages all at once. As a Web developer you can define a style for each HTML element and apply it to as many Web pages as you want. To make a global change, simply change the style, and all elements in the Web are updated automatically.
ultiple Styles Will Cascade Into One
Style sheets allow style information to be specified in many ways. Styles can be specified inside a single HTML element, inside the head element of an HTML page, or in an external CSS file. Even multiple external style sheets can be referenced inside a single HTML document.
Cascading Order
What style will be used when there is more than one style specified for an HTML element?
Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:
1. Browser default
2. External style sheet
3. Internal style sheet (inside the head tag)
4. Inline style (inside an HTML element)
Anyway, HAPPY 42nd FOUNDATION DAY to all of you!
Saturday, February 7, 2009
learnings of the week (betinol)
HTML, an initialism of HyperText Markup Language, is the predominant markup language for Web pages. It provides a means to describe the structure of text-based information in a document — by denoting certain text as links, headings, paragraphs, lists, and so on — and to supplement that text with interactive forms, embedded images, and other objects. HTML is written in the form of tags, surrounded by angle brackets. HTML can also describe, to some degree, the appearance and semantics of a document, and can include embedded scripting language code (such as JavaScript) which can affect the behavior of Web browsers and other HTML processors.
Contents
We had to do this for one week.Though I'm not successful in doing this because, still I did my best.
February 2 -6, 2009
By: Cielito M. Cantero
IV - Rizal
I'm very tired this week making our final HTML...
I added many applications in my work that I've learn from some sites.
For me, I think I've done my HTML well.
I've given my whole time, effort and money on it.
And also this week, we also have some sort of reviews about html...
In making html, first you have to make it in a notepad, like below:
‹html›
‹head›
‹title›Title of the page‹/title›
‹/head›
‹body›
This is my first homepage. ‹b›This text is bold ‹/b›
‹/body›
‹/html›
♦When you save an HTML file, you can use either the .htm or the .html extension. We have used .htm in our examples. It might be a bad habit inherited from the past when some of the commonly used software only allowed three letters extensions.
♦You can easily edit files using a WYSIWYG (what you see is what you get) editor like Frontpage, Claris Home Page or Adobe PageMill instead of writing your markup tags in a plain text file.
♦But if you want to be skillful Web developer, we strongly recommend that you use a plain text editor to learn your primer HTML.
♦HTML documents are text files made up of HTML elements.
♦HTML elements are defined using HTML tags.
♦HTML tags are used to mark-up HTML elements
♦HTML tags are surrounded by the two characters <>
♦The surroundings characters are called angle brackets
♦HTML tags normally come in pairs like ‹b›and‹/b›
♦The first tag in a pair is the start tag, the second tag is the end tag
♦The text between the start and end tags is the element content.
♦HTML tags are not case sensitive, ‹b› means the same as ‹B›
That's ALL.. =>
-------------------------------------------------------------------------------------
humana jud ang html..
hay!! kakapoy..
ma-alas onsehan sa internetan..
hadlok au..
at last..natapos din..
:-)
Sunday, February 1, 2009
learnings of the week (lorebeth betinol)
Each day our webpage is improving. Everytime we need help our mates are just there to help us.
We started it with heading and............................. everything comes next. All we have to do is to make it beautiful. We put some navigating buttons, pictures and background.
It is similar with making a program in the computer.
Januray 26 - 30, 2009
By: Cielito M. Cantero
IV - Rizal
Sir Ernie was not around this week.. =[
I think he had to go to a seminar or something chuva...
Last week, before the week end, he told us to make a html.
And also he give some Introduction about HTML and taught us some basic examples...
This week, we were so busy in making our very own HTML.
And also Sir told us to upload some HTML everyday to see some improvements.
Although making HTML was something fun,
making things like HTML requires more time, effort and especially money for those
students like me who don't have personal computers
at home...
HTML is amazing!!
That's all..
-------------------------------------------------------------------------------------
suko na ako mama & papa Sir kay cge ra daw me net...
gasto daw au ko.
cge ra ko balik net pra ma-improve ako HTML..
4 hours a day gud ko Sir..
grabeh nOh?? mahal au..
huhuhu... T_T
Saturday, January 31, 2009
Sunday, January 25, 2009
learnings of the week (lorebeth betinol)
A web page or webpage is a resource of information that is suitable for the World Wide Web and can be accessed through a web browser. This information is usually in HTML or XHTML format, and may provide navigation to other web pages via hypertext links.
Web pages may be retrieved from a local computer or from a remote web server. The web server may restrict access only to a private network, e.g. a corporate intranet, or it may publish pages on the World Wide Web. Web pages are requested and served from web servers using Hypertext Transfer Protocol (HTTP).
Web pages may consist of files of static text stored within the web server's file system (static web pages), or the web server may construct the (X)HTML for each web page when it is requested by a browser (dynamic web pages). Client-side scripting can make web pages more responsive to user input once in the client browser.
Creating a web page
To create a web page, a text editor or a specialized HTML editor is needed. In order to upload the created web page to a web server, traditionally an FTP client is needed.
The design of a web page is highly personal. A design can be made according to one's own preference, or a pre-made web template can be used. Web Templates let web page designers edit the content of a web page without having to worry about the overall aesthetics. Many people publish their own web pages using products like Geocities from Yahoo, Tripod, or Angelfire. These web publishing tools offer free page creation and hosting up to a certain size limit.
Other ways of making a web page is to download specialized software, like a Wiki, CMS, or forum. These options allow for quick and easy creation of a web page which is typically dynamic.
Saturday, January 24, 2009
Hypertext Markup Language (HTML) in computer science, the standard text-formatting language since 1989 for documents on the interconnected computing network known as the World Wide Web. HTML documents are text files that contain two parts: content that is meant to be rendered on a computer screen; and markup or tags, encoded information that directs the text format on the screen and is generally hidden from the user. HTML is a subset of a broader language called Standard Generalized Markup Language (SGML), which is a system for encoding and formatting documents, whether for output to a computer screen or to paper.
Some tags in an HTML document determine the way certain text, such as titles, will be formatted. Other tags cue the computer to respond to the user's actions on the keyboard or mouse. For instance, the user might click on an icon (a picture that represents a specific command), and that action might call another piece of software to display a graphic, play a recording, or run a short movie. Another important tag is a link, which may contain the Uniform Resource Locator (URL) of another document. The URL can be compared to an address where a particular document resides. The document may be stored on the same computer as the parent document or on any computer connected to the World Wide Web. The user can navigate from document to document simply by clicking on these links. HTML also includes markups for forms that let the user fill out information and electronically send, or e-mail, the data to the document author, and initiate sophisticated searches of information on the Internet, or order goods and services.
The software that permits the user to navigate the World Wide Web and view HTML-encoded documents is called a browser. It interprets the HTML tags in a document and formats the content for screen display. Since HTML is an accepted standard, anyone can build a browser without concerning themselves with what form various documents will assume, unlike documents produced by typical word processors, which must be translated into a different format if another word processing application is used. Most sites on the World Wide Web adhere to HTML standards and, because HTML is easy to use, the World Wide Web has grown rapidly. HTML continues to evolve, however, so browsers must be upgraded regularly to meet the revised standards.
January 19 - 23, 2009
By: Cielito M. Cantero
IV - Rizal
This week??
This week we dont tackled anything.
I guess Sir Balbuena was so busy... =<
What we done this week?
We just check our test papers for the third grading periodical examination.
And don't learn new things about tle this week..
This week, we also have our recollection held at Molave Hotel..
January 20 was the exact date..
Maybe next week we will have to learn something about making web page.
The best thing is we're now off with programming.
yipeey!!
oOh yes!!
-------------------------------------------------------------------------------------
nkarelax jud me kron na week..
wheew..
sus,. lisod man gud au programming bah.
at last humana jud ang programming!!!!!
yeheey!! :]
Thursday, January 22, 2009
Sunday, January 18, 2009
Learnings of the week (Lorebeth Betinol)
This week we had discussed all about arrays, and............ here it goes...............
***Single – Dimensional Arrays
Array is a collection of variables of the same data type that is referenced by a common name.
Array declaration
The general form for any declaration is as follows:
type array_name[size];
Where:
type is any valid data type in Turbo C which declares the type of values that array will hold.
array_name is a valid variable name which will name the array.
size defines how many elements the array will hold.
The two declarations for arrays number and answer can be combined into a single declaration:
int number[100] , answer [25];
array initialization
Arrays can give initial values during the declaration. This is called array initialization..
int Array1[5]={25, 5, 7, 11, 163};
In computer science, an array[1] is a data structure consisting of a group of elements that are accessed by indexing. In most programming languages each element has the same data type and the array occupies a contiguous area of storage.
Overview
Most programming languages have a built-in array data type, although what is called an array in the language documentation is sometimes really an associative array. Conversely, the contiguous storage kind of array discussed here may alternatively be called a vector, list,[2] or table.[3]
Some programming languages support array programming (e.g., APL, newer versions of Fortran) which generalises operations and functions to work transparently over arrays as they do with scalars, instead of requiring looping over array members.
Multi-dimensional arrays are accessed using more than one index: one for each dimension. Multidimensional indexing reduced to a lesser number of dimensions, for example, a two-dimensional array with consisting of 6 and 5 elements respectively could be represented using a one-dimensional array of 30 elements.
Arrays can be classified as fixed-sized arrays (sometimes known as static arrays) whose size cannot change once their storage has been allocated, or dynamic arrays, which can be resized.
[edit] Properties
Arrays permit constant time (O(1)) random access to individual elements, which is optimal, but moving elements requires time proportional to the number of elements moved. On actual hardware, the presence of e.g. caches can make sequential iteration over an array noticeably faster than random access — a consequence of arrays having good locality of reference because their elements occupy contiguous memory locations — but this does not change the asymptotic complexity of access. Likewise, there are often facilities (such as memcpy) which can be used to move contiguous blocks of array elements faster than one can do through individual element access, but that does not change the asymptotic complexity either.
Memory-wise, arrays are compact data structures with no per-element overhead. There may be a per-array overhead, e.g. to store index bounds, but this is language-dependent. It can also happen that elements stored in an array require less memory than the same elements stored in individual variables, because several array elements can be stored in a single word; such arrays are often called packed arrays.
Saturday, January 17, 2009
Array[0] = 25
Parts of the Array:
Where:
Array – array name
[0] – subscript or index
25 – array element
ARRAY DECLARATION
This is the general form for any declaration:
type array_name[size];
Where:
type is any valid data type in Turbo C which declares the type of values that array will hold.
array_name is a valid variable name which will name the array.
size defines how many elements the array will hold.
int number[100] , answer [25];
Learnings of the Week!! (Jan 12-16)
Steffany Queen P. Bigoy
Array is a collection of variables of the same data type that is referenced by a common name.
Consider the illustration below…
#include
{
int array[4]={25,5,7,11,163};
clrscr();
printf(“%d %d %d %d %d”, array[0], array[1], array[2],array[3],array[4]);
getch();
}
Output:
25 5 7 11 163
Array declaration
The general form for any declaration is as follows:
type array_name[size];
Where:
type is any valid data type in Turbo C which declares the type of values that array will hold.
array_name is a valid variable name which will name the array.
size defines how many elements the array will hold.
Array declaration
lThe two declarations for arrays number and answer can be combined into a single declaration:
int number[100] , answer [25];
Array Initialization
lArrays can give initial values during the declaration. This is called array initialization..
int Array1[5]={25, 5, 7, 11, 163};
January 12 - 16, 2009
By: Cielito M. Cantero
IV - Rizal
The students were very busy this week. Because this week was the time for us to take our third periodical examination.
We took the T.L.E examination January 16.
It was really really HARD...
I
I still get confused every time I trace the program...
I spend lot of the time in analyzing the program...
For me, programming is one of hardest lesson I've ever took...
And also, we have some reviews about our past lessons before the day of the test come.
We also discussed about array this week. To understand more about array, read below.
Array is a collection of variables of the same data type that is referenced by a common name.
Consider the illustration below…
#include
{
int array[4]={25,5,7,11,163};
clrscr();
printf(“%d %d %d %d %d”, array[0], array[1], array[2],array[3],array[4]);
getch();
}
Output:
25 5 7 11 163
Array declaration
The general form for any declaration is as follows:
type array_name[size];
Where:
type is any valid data type in Turbo C which declares the type of values that array will hold.
array_name is a valid variable name which will name the array.
size defines how many elements the array will hold.
The two declarations for arrays number and answer can be combined into a single declaration:
int number[100] , answer [25];
array initialization
Arrays can give initial values during the declaration. This is called array initialization..
int Array1[5]={25, 5, 7, 11, 163};
-------------------------------------------------------------------------------------------------
huhuhu..
la jud koy nasabtan miskan unsaon...
how sad... :-(
Saturday, January 10, 2009
By: Frea Diane T. Bautista
This week, we have discussed about Recursion.
Recursion in computer science is a way of thinking about and solving problems. It is, in fact, one of the central ideas of computer science. [1] Solving a problem using recursion means the solution depends on solutions to smaller instances of the same problem. [2]
Most high-level computer programming languages support recursion by allowing a function to call itself within the program text. Imperative languages define looping constructs like “while” and “for” loops that are used to perform repetitive actions. Some functional programming languages do not define any looping constructs but rely solely on recursion to repeatedly call code. Computability theory has proven that these recursive only languages are mathematically equivalent to the imperative languages, meaning they can solve the same kinds of problems even without the typical control structures like “while” and “for”."The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions." [3]
Examples of recursively defined procedures (generative recursion)
Factorial
A classic example of a recursive procedure is the function used to calculate the factorial of an integer.
Function definition: 0 \\ \end{cases}" src="http://upload.wikimedia.org/math/9/6/7/967ff33812b62076e5de85fe7fb40b83.png">
| Pseudocode (recursive): |
|---|
function factorial is: |
A recurrence relation is an equation that relates later terms in the sequence to earlier terms[6].
Recurrence relation for factorial:
bn = n * bn-1
b0 = 1
| Computing the recurrence relation for n = 4: |
|---|
b4 = 4 * b3 |
Example Implementations:
| Scheme (recursive) | C (recursive) |
|---|---|
;; Input: Integer n such that n >= 0 | //INPUT: n is an integer such that n >= 0 |
Learnings (lorebeth)
We had discussed about recursion, even though it is hard to understand but still I'm trying my best.
Recursion defined
The repetitive process by which a functions calls itself is called recursion or circular definition.
This is a way of defining something in terms of itself.
A function is said to be recursive if a statement in the body of the function calls the function that contains it.
Parts of the Recursive function
Base Case
This is the part of the recursive function that is found on the if clause. This contains the condition that should be satisfied at one point of execution to terminate the repetitive process done by the recursive function.
General Case
This is the part of the recursive function that is found on the else-clause. This contains the function call of the recursive function to itself.
Recursion in computer science is a way of thinking about and solving problems. It is, in fact, one of the central ideas of computer science. [1] Solving a problem using recursion means the solution depends on solutions to smaller instances of the same problem. [2]
"The power of recursion evidently lies in the possibility of defining an infinite set of objects by a finite statement. In the same manner, an infinite number of computations can be described by a finite recursive program, even if this program contains no explicit repetitions." [3]
Most high-level computer programming languages support recursion by allowing a function to call itself within the program text. Imperative languages define looping constructs like “while” and “for” loops that are used to perform repetitive actions. Some functional programming languages do not define any looping constructs but rely solely on recursion to repeatedly call code. Computability theory has proven that these recursive only languages are mathematically equivalent to the imperative languages, meaning they can solve the same kinds of problems even without the typical control structures like “while” and “for”.
January 5 - 9, 2009
By: Cielito M. Cantero
IV - Rizal
This week we discussed about recursion.
*RECURSION- defined as the repetitive process by which a function calls itself. It is also termed as the CIRCULAR DEFINITION. Recursion is also a programming technique where a routine performs its task by delegating part of it to another instance of itself.
For example in this program segment:
Factorial (int n)
{
If (n==1||n==0) return 1;
else return (n * factorial (n-1));
}
In this program segment, it illustrates a function containing a call to it. The lines else return (n * factorial (n-1)); contains the function call for the factorial function.
The parts of the recursive function include the Base Case. The base case can be found in the “if clause”. It contains the condition that should be satisfied at one point of execution to terminate the repetitive process done be the recursive function. And the other part of the recursive function is the General Case. The general case can be located on the “else-clause”. It contains the function call of the recursive function to itself.
The Direct Recursion is a recursive functions that can call itself through a function call directly inside the body of the function. While the second type of recursion is the indirect recursion. The Indirect Recursion is a recursive functions that can call another function outside its function.
And we also have an activity regarding the lesson...
hehe,. =)
Friday, January 9, 2009
Learnings of the Week!!
RECURSION.Well, we have activities regarding the recursion. Mr. Balbuena teaches this lesson well, but in our the activity given, we have encountered some difficulties in running our program. God! napaka-hirap talaga 'nun.
Here's some of our discussions:
Recursion is repetitive process by which a function calls itself. It is also termed as the circular.
The Direct Recursion is a recursive functions that can call itself through a function call directly inside the body of the function. While the second type of recursion is the indirect recursion. The
Indirect Recursion is a recursive functions that can call another function outside its function.
For example in this program segment:
Factorial (int n)
{
If (n==1n==0) return 1;
else return (n * factorial (n-1));
}
In this program segment, it illustrates a function containing a call to it. The lines else return (n * factorial (n-1)); contains the function call for the factorial function.
The parts of the recursive function include the Base Case. The base case can be found in the “if clause”. It contains the condition that should be satisfied at one point of execution to terminate the repetitive process done be the recursive function. And the other part of the recursive function is the General Case. The general case can be located on the “else-clause”. It contains the function call of the recursive function to itself.
Most high-level computer programming languages support recursion by allowing a function to call itself within the program text. Imperative languages define looping constructs like “while” and “for” loops that are used to perform repetitive actions. Some functional programming languages do not define any looping constructs but rely solely on recursion to repeatedly call code. Computability theory has proven that these recursive only languages are mathematically equivalent to the imperative languages, meaning they can solve the same kinds of problems even without the typical control structures like “while” and “for”....Ü
Saturday, January 3, 2009
Friday, January 2, 2009
Learnings- Lorebeth
Christmas is finished but it's a Happy 100x New year guys.....................
Lets welcome the 2009 which is the year of the OX with a big S.M.I.L.E.
Opps! Vacation will be finish and say "hello" to class.
I just read this one:
Auto-increment and Auto-decrement Operators
- instead of using i = i+1 use equivalent statement i++
- similarly j = j-1 can be written as j--
- similarly a = a+b can be written as a += b
- similarly c = c-d can be written as c -= d
- similar compact forms for * / and % exist
- this results in shorter (and often faster) code
Thursday, January 1, 2009
learnings
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!!

