<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Site Title</title>
	<atom:link href="https://codestar.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://codestar.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 30 May 2018 05:50:12 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">146566729</site><cloud domain='codestar.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s2.wp.com/i/webclip.png</url>
		<title>Site Title</title>
		<link>https://codestar.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://codestar.wordpress.com/osd.xml" title="Site Title" />
	<atom:link rel='hub' href='https://codestar.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Programming languages</title>
		<link>https://codestar.wordpress.com/2018/05/30/programming-languages/</link>
					<comments>https://codestar.wordpress.com/2018/05/30/programming-languages/#respond</comments>
		
		<dc:creator><![CDATA[delta3936]]></dc:creator>
		<pubDate>Wed, 30 May 2018 05:50:12 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://codestar.wordpress.com/?p=18</guid>

					<description><![CDATA[&#160; 2.1. What is a Programming Language There are many definitions of what constitutes a programming language, and none of these is the correct answer. What might have defined a programming language in the 19th century would not necessarily be detailed enough for a modern definition. Programming languages are needed to allow human beings and &#8230; <a href="https://codestar.wordpress.com/2018/05/30/programming-languages/" class="more-link">Continue reading <span class="screen-reader-text">Programming languages</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>&nbsp;</p>
<p>2.1. What is a Programming Language<br />
There are many definitions of what constitutes a programming language, and none of these is the correct answer. What might have defined a programming language in the 19th century would not necessarily be detailed enough for a modern definition. Programming languages are needed to allow human beings and computers to talk to each other. Computers, as yet, are unable to understand our everyday language or, in fact, the way we talk about the world. Computers understand logic expressed mathematically through what is known as machine code. Computer language consists of 1s and 0s or the binary system, which the majority of human beings would find very difficult to communicate in. Computer languages enable humans to write in a form that is more compatible with a human system of communication. This is then translated into a form that the computer can understand. Here are some different ideas on what constitutes a programming language.<br />
A programming language has been defined as a tool to help the programmer.<br />
A way of writing that can be read by both a human being and a machine.<br />
A sequence of instructions for the machine to carry out.<br />
A way for a human being to communicate with a machine that is unable to understand natural language.<br />
A computer language offers a means of writing algorithms that can be understood by both human being and machine. Machines are unable to understand natural language, so a human being uses algorithms that are translated into machine code by the programming language. Machine code is difficult for humans to use, so a language translates human readable language into machine readable form.<br />
A computer program offers humans a standard way of expressing algorithms to solve particular problems. As languages offer a convention it allows other humans to read the program, and change it if they need to.</p>
<p>2.2. Types of Programming Languages<br />
There are three levels of programming languages;<br />
Machine language (low level language)<br />
Assembly (or symbolic) language<br />
Procedure-oriented language (high level language)</p>
<p>2.2.1. Machine language<br />
The lowest-level programming language (except for computers that utilize programmable microcode) Machine languages are the only languages understood by computers. While easily understood by computers, machine languages are almost impossible for humans to use because they consist entirely of numbers. It is a programming language in which the instructions are in a form that allows the computer to perform them immediately, without any further translation being required. Instructions are in the form of a Binary code also called machine code and are called machine instructions. Commonly referred to as the First Generation language</p>
<p>2.2.2. Assembly Language<br />
Introduced in 1950s, reduced programming complexity and provided some standardization to build and applications. Also referred to second generation language. The 1 and 0 in machine language are replaced by with abbreviations or mnemonic code. It consists of a series of instructions and mnemonics that correspond to a stream of executable instructions. It is converted into machine code with the help of an assembler. Common features includes;<br />
Mnemonic code; used in place of the operation code part of the instruction eg SUB for substract, which are fairly easy to remember<br />
Symbolic Addresses which are used in place of actual machine addresses. A programmer can choose a symbol and use it consistently to refer to one particular item of data. Example FNO to represent First No.<br />
The symbolically written program has to be translated into machine language before being used operationally. A 1 to 1 translation to machine language, ie one symbolic instruction produces one machine instruction/code.</p>
<p>Advantages of Assembly language over machine language<br />
It is easy to locate and identify syntax errors, thus it is easy to debug it.<br />
It is easier to develop a computer application using assembly language in comparison with machine language<br />
Assembly language operates very efficiently.</p>
<p>&nbsp;</p>
<p>2.2.3. High level language<br />
A Machine independent and a Problem oriented (POL) programming language. High level language is portable across different machine types (architectures); The machine independence of the high level languages means that in principle it should be possible to make the same high-level language run on different machines. It reflects the type of problem solved rather than the features of the machine.</p>
<p>High level languages are more abstract, easier to use and more portable across platforms as compared to low-level programming languages. A programmer uses variables, arrays or Boolean expressions to develop the logic to solve a problem. Source programs are written in statements akin to English. A high level language code is executed by translating it into the corresponding machine language code with the help of a compiler or interpreter. High level languages can be classified into the following categories;<br />
Procedure-oriented languages (third generation)<br />
Problem-oriented languages (fourth generation)<br />
Natural languages (fifth generation).</p>
<p>Procedure languages.<br />
High-level languages designed to solve general-purpose problems, example BASIC, COBOL, FORTRAN, C, C++ and JAVA. They are designed to express the logic and procedure of a problem. Though the syntax of the languages may be different, they use English-like commands that are easy to follow. They are portable.</p>
<p>Problem-oriented languages<br />
Problem-oriented languages also known as Fourth Generation Languages (4GL) are used to solve specific problems and includes query languages, report generators and Application generators which have simple English like syntax rules. The 4GLs have reduced programming efforts and overall cost of software development. They use either visual environment or a text environment for program development similar to that of third-generation languages. A single statement of the 4GL can perform the same task as multiple line of a third-generation language. It allows a program to just drag and drop from the toolbar, to create various items like buttons, text boxes, label etc. A program can quickly create a prototype of the software applications</p>
<p>Natural Languages<br />
Natural languages widely known as fifth generation languages, are designed to make a computer to behave like an expert and solve problems. The programmer just needs to specify the problem and the constraints for problem solving. Natural languages such as LISP and PROLOG are mainly used to develop artificial intelligence and expert systems.</p>
<p>Features of high level language<br />
Extensive vocabulary of words, symbols and sentences<br />
Whole sentences are translated into many machine codes instructions<br />
Portable across different machine types (architectures)<br />
Libraries of macros and sub-routines can be incorporated<br />
As they are problem oriented, the programmer is able to work at least to some extent independently of the machine.<br />
Have a set of rules that must be obeyed.<br />
Syntax: the structure of the statements and the grammatical rules governing them. Grammatical rules that govern the way in which words, symbols, expressions and statements may be formed and combined.<br />
Semantics: the meaning of the statements written in the language. The rules that governs its meaning. what happens when the program is executed/run most are standardized by ISO/ANSI to provide an official description of the language</p>
<p>2.3. High Level language Translation<br />
High level languages need to be translated into machine language which is the computer language. The translation is done by a Compiler or Interpreter</p>
<p>2.3.1. Compiler<br />
A compiler is a manufacturer specifically written computer program which translates (or compiles) a source code computer program that translates the source code written in a high level language into the corresponding object code of the low level language. The translation process is called compilation. The entire high level source code / program is converted into the executable machine code file prior to the object program being loaded into main memory and executed. Translation done only ones and the object program can be loaded into the main storage and executed. A program that translates a low-level language into a high level language is called a Decompiler. Compiled languages includes C, C++, COBOL, FORTRAN etc.</p>
<p>Compilers are classified into single-Pass compilers and Multi-pass compilers. Single-pass compilers are generally faster than multi-pas compilers, but multi-pass compilers are required to generate high quality code</p>
<p>A Compiler:<br />
Translates the source program code into machine code<br />
Includes linkages for closed sub-routine<br />
Allocates areas of main storage<br />
Produces the object program.<br />
Produces a printed copy (listing) of the source code and object code<br />
Produces a list of errors found during compilation.</p>
<p>2.3.2. Interpreter:<br />
The interpreter is a translation program that converts each high-level language statement into the corresponding machine code. The translation process is carried out just before the program statement is executed. Instead of the entire program, one program statement at a time is translated and executed immediately. When using an interpreter, the source code translated every time the program is executed</p>
<p>The commonly interpreted languages include BASIC and PERL. Though interpreters are easier to create as compared to compilers, the compiled languages can be executed more efficiently and are faster. Interpreters are appropriate in;<br />
Handling user commands in an interactive system<br />
Debugging programs as they run (removing program faults).<br />
Handling software produced for or by a different computer.</p>
<p>2.4. Computer Program Compilation Process<br />
A computer program compilation process involves the following five stages;<br />
Lexical analysis: the source program is transformed into tokens. During the transformation all whitespaces and comments are discarded. All character sequences that do not form valid tokens are discarded and an error message is generated.<br />
Syntactical analysis: analysis to ensure the program syntax is appropriate to the language. Failure results in an error message been generated.<br />
Type / Semantic checking: responsible for ensuring that the compile-time semantic rules of the language are enforced. An error message is generated if the semantic rules are violated<br />
Code optimization: improves the intermediate code based on the target machine architecture<br />
Code generation: target machine code is generated.</p>
<p>The first three stages are concerned with finding and reporting errors to the programmer, while the last two are concerned with generating efficient machine code to run on the targeted computer.</p>
<p>&nbsp;</p>
<p>Source Machine<br />
Code Code</p>
<p>2.5. Evaluating Languages<br />
Programming languages can be evaluated from a number of viewpoints, depending on either the programmer, the environment in which the programmer works or the standards of the organisation. When developing software, a programmer should consider which language is most suitable to the task, rather than relying on a language with which they are familiar. You wouldnt want to use a spreadsheet to develop a database. All the features of the language need to be considered rather than just one particular feature. A wrong choice can mean that the software has to be re-written, which can be very frustrating and time consuming.</p>
<p>There are a number of different ways that the programmer can think about the design of the system, from the top-down of structured programming to object oriented design issues. Some languages are geared towards one particular style of design, whilst others incorporate many types. Each of these language paradigms enables the programmer to consider the problem from a different viewpoint. There are a few basic questions that can be asked to help when making these decisions:</p>
<p>How readable is the language, to humans? If parts of the program are going to be read or altered separately from the entire program is might be worth considering how legible they are going to be. It is also useful to consider the length of names allowed in the language, for instance an early form of Fortran allowed for only 6 characters. This can lead to clumsy abbreviations that are difficult to read. Statements such as GO TO, FOR, WHILE and LOOP have increased the readability of programs, and lead to neater programs. These statements also affect the syntax or grammar.<br />
When it comes to writing the program, how easy is it to write the program in this particular language? A programming language that is easy to write in can make the process easier and faster. It may help to reduce mistakes. FOR loops and other types of statement allow the programmer to write much simpler code. This will save time and money, and also make the program smaller.<br />
How reliable is the language? Not all languages create robust programs, and some help the programmer to avoid making errors. A program that is not robust can cause errors, and code can decay. Any language that helps the programmer to avoid mistakes will make it easier to use.<br />
How much would it cost to develop using a given language? Is the language expensive to use and to maintain? Programs may need to be updated or redeveloped, and an expensive language may make this prohibitive.<br />
How complicated is the syntax going to be? Syntax is an important consideration. Clarity and ease of understanding are important, as is a syntax that seems logical and sensible. Errors are very likely to occur where one area of syntax too closely resembles another, and the program may prove difficult to debug. Some theorists reason that if it is difficult to write a program to parse the language, then it follows that it will be problematical for the programmer to get it right.<br />
Does the language have standards? Languages that have standards for writing programs have greater readability; for instance Java has standards for naming, commenting and capitalization.</p>
<p>2.6. The Programming Language Generations<br />
The language generations span many decades, and begin with the development of machine code. Each generation adds new features and capabilities for the programmer to use. Languages are designed to create programs of a particular type, or to deal with particular problems. Modern languages have led to the development of completely different styles of programming involving the use of more human-like or natural language and re-usable pieces of code.<br />
The first generation of languages was machine language. Instructions and addresses were numerical. These programs were linked to the machine they were developed on.<br />
The second generation allowed symbolic instructions and addresses. The program was translated by an assembler. Languages of this generation include IBM, BAL, and VAX Macro. These languages were still dependent on the machine they were developed on.<br />
Third generation languages allowed the programmer to concentrate on the problem rather than the machine they were writing for. Other innovations included structured programming and database management systems. 3GL languages include FORTRAN, COBOL, Pascal, Ada, C, and BASIC. All 3GL languages are much easier for the human being to understand.<br />
4GL languages (fourth generation). These are known as non-procedural, they concentrate on what you want to do rather than how you are going to do it. 4GL languages include SQL, Postscript, and relational database orientated languages.<br />
5GL (fifth generation). These languages did not appear until the 1990s, and have primarily been concerned with Artificial Intelligence and Fuzzy Logic. The programs that have been developed in these languages have explored Natural Language (making the computer seem to communicate like a human being).</p>
<p>Chapter Review Questions<br />
Describe the C program compilation process<br />
What criteria should a programmer use to evaluate a programming language<br />
What are advantages of High-level languages over the Assembly language.<br />
Describe the categories of the high-level languages</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codestar.wordpress.com/2018/05/30/programming-languages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">18</post-id>
		<media:content url="https://2.gravatar.com/avatar/b297cad9e7e8e24a970bd9c5b56e621f82d1651f1845cb2b0706d68419e7fcb4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">delta3936</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to C programming</title>
		<link>https://codestar.wordpress.com/2018/05/01/introduction-to-c-programming/</link>
					<comments>https://codestar.wordpress.com/2018/05/01/introduction-to-c-programming/#respond</comments>
		
		<dc:creator><![CDATA[delta3936]]></dc:creator>
		<pubDate>Tue, 01 May 2018 05:45:13 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://codestar.wordpress.com/?p=16</guid>

					<description><![CDATA[Programming is the process of producing a computer program. Programming involves the following activities; writing a program, compiling the program, running the program, debugging the programs. The whole process is repeated until the program is finished. A programmer, computer programmer, developer, coder, or software engineer is a person who writes computer software. The term computer &#8230; <a href="https://codestar.wordpress.com/2018/05/01/introduction-to-c-programming/" class="more-link">Continue reading <span class="screen-reader-text">Introduction to C&#160;programming</span> <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>Programming is the process of producing a computer program. Programming involves the following activities; writing a program, compiling the program, running the program, debugging the programs. The whole process is repeated until the program is finished.<br />
A programmer, computer programmer, developer, coder, or software engineer is a person who writes computer software. The term computer programmer can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software. The term programmer can be used to refer to a software developer, Web developer, mobile applications developer, embedded firmware developer, software engineer, computer scientist, or software analyst<br />
What is Computer Programming Methodology<br />
A Methodology is a system of methods with its orderly and integrated collection of various methods, tools and notations. A computer program is a series of instructions written in the language of the computer which specifies processing operations that the computer is to carry out on data. It is a coded list of instructions that tell&#8221; a computer how to perform a set of calculations or operations.</p>
<p>1.2. Problem Solving with Computer;<br />
There are a number of concepts of relevance to problem solving using computers. Two particular concepts includes computability and complexity. A problem is said to be computable if it can in principle be performed by a machine. Some mathematical functions are not computable. The complexity of a problem is measured in terms of resources required, time and storage</p>
<p>The steps involved in solving a problem using a computer program includes;<br />
Step 1. Define the Problem: State in the clearest possible terms the problem you wish to solve. It is impossible to write a computer program to solve a problem that has been ambiguously or imprecisely stated.<br />
Step 2. Devise an Algorithm: An algorithm is a step-by-step procedure for solving the problem. Each of the steps must be a simple operation which the computer is capable of doing. A universally-used representation of an algorithm is a flowchart or flow diagram, in which boxes representing procedural steps are connected by arrows indicating the proper sequence of the steps. In many problems you will need to define a mathematical procedure, expressed in strictly numerical terms since the use of computers to do higher level analytic processes such as solving algebraic equations or doing integrals in a non-numerical fashion is relatively limited. The Algorithm can also be represented using Pseudo-code<br />
Step 3. Code the Program: The steps in an algorithm, translated into a series of instructions to the computer, comprise the computer program. There are many languages in which computer programs can be coded, each with its own syntax, vocabulary, and special features.<br />
Step 4. Debug the Program: Most programs of any length don&#8217;t work properly the first time they are run and must therefore be debugged.&#8221; Often, during the debugging phase, errors and ambiguities in the original statement of the problem reveal themselves, calling for basic revisions in the solution algorithm.<br />
Step 5. Run the Program: After the program has been fully debugged you run it, possibly using many sets of input data. This step may take anywhere from a few seconds to many hours depending on the complexity of the problem and the speed of the computer.<br />
Step 6. Analyze the Results: Often the output from a computer program requires considerable further analysis. In some cases, even though the program worked perfectly, you may find that you solved the wrong&#8221; problem. There is an acronym well known to computer users: GIGO, which stands for garbage in, garbage out.&#8221;</p>
<p>1.2.1. Problem Algorithm<br />
An Algorithm is a logical sequence of discrete steps that describe a complete solution to a given problem in a finite amount of time independently of the software or hardware of the computer. It is the set of rules that define how a particular problem can be solved in finite number of steps. Algorithms are very essential as they instructs the computer what specific steps it needs to perform to carry out a particular task or solve a problem. Every algorithm should have the following five characteristics: Input, Output, Definiteness, Effectiveness and Termination. An Algorithm has the following properties;<br />
It must be precise and unambiguous<br />
It must give the correct solution in all cases<br />
It must eventually end.</p>
<p>Efficiency and Analysis of the Algorithm<br />
The efficiency of an Algorithm means how fast it can produce the correct results for the given problem. The Algorithm efficiency depends upon its time complexity and space complexity. The complexity of an algorithm is a function that provides the running time and space for data, depending on the size provided by us. Two important factors for judging the complexity of an Algorithm are; space complexity which refers to the amount of memory required by the algorithm for it execution and generation of the final output and time Complexity which refers to the amount of computer time required by an algorithm for its execution, which includes both the compile time and run time. The compile time of an algorithm does not depend on the instance characteristics of the algorithm. The run time of an algorithm is estimated by determining the number of various operation, such as addition, subtraction, multiplication, division, load and store executed by it.</p>
<p>The analysis of an algorithm determines the amount of resources, such as time and space required by it for its execution. Generally, the algorithms are formulated to work with the inputs or arbitrary length. Algorithm analysis provides theoretical estimates required by an algorithm to solve a problem. The steps of an Algorithm, they can be presented using Flow charts and pseudo-codes.</p>
<p>1.3. Flow Charts<br />
A flow chart is a traditional means of showing in diagrammatic form, the sequence of steps to be undertaken in solving a problem. Flowcharts or flow diagrams are important tools in writing a computer program. A flowchart allows you to plan the sequence of steps in a program before writing it. The flowchart serves as a visual representation which many programmers find indispensable in planning any program of at least moderate complexity.</p>
<p>1.3.1. Elements of a Flowchart.<br />
A flowchart consists of a set of boxes, the shapes of which indicate specific operations. The separate boxes are connected with arrows to show the sequences in which the various operations are performed. We use these standard symbols:</p>
<p>Shape<br />
Name<br />
Description</p>
<p>&nbsp;</p>
<p>Rectangle<br />
Process symbol: Used to represent any kind of processing activity. Details are written in the box</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Diamond:<br />
The decision Symbol: Used where a decision has to be made in selecting the subsequent path to be followed.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Used to show the flow/ path of ma sequence of symbols.<br />
Vertical line without arrow head are assumes t flow top to bottom.<br />
Horizontal lines without arrow heads are assumed to flow left to right.<br />
Every operation box must have at least one incoming or outgoing arrow. Any arrow leaving a decision box must be labeled with the decision result which will cause that path to be followed.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Parallelogram<br />
Input/output symbol: Used where data input is to be performed</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Oval<br />
The Terminal symbol: Used as the first or last symbol in a program or separately drawn program module</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Or</p>
<p>&nbsp;</p>
<p>Small Circle<br />
Connector symbol:</p>
<p>Exit to or entry from another part of the chart</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Used to add explanatory notes or description,</p>
<p>&nbsp;</p>
<p>Stages of Flow charting<br />
Program flowcharts are generally produced in two stages representing different levels of details. The first step produces the outline program flow chart which represents the first stage of turning the systems flow charts into the necessary detail to enable the programmer to write the programs. It represents the actual computer operations in an outline only. The second step produces the detailed program flow chart which is prepared from the outline charts and contains the detailed computer steps necessary to perform a particular task. It is from this charts that the programmer will prepare the program code</p>
<p>Limitations of program flowcharts<br />
Not easily translated into programming language.</p>
<p>1.4. Pseudo code<br />
An alternative method of representing an Algorithm to the flowcharts. Pseudo code is halfway between English and programming language and is based upon a few simple grammatical construction which avoid the ambiguities of English but which can be easily converted into computer programming language. Pseudo code is an informal high-level description of a computer programming algorithm, which omits details that are not essential for human understanding of the algorithm, is easier for humans to understand than conventional programming language code, is compact and environment-independent description of the key principles of an algorithm and resembles skeleton programs including dummy code and can be compiled without errors.</p>
<p>Pseudo code assumes that programming procedures no matter how complex may be reduced to a combination of controlled sequences, selection, or repetition of basic operations. This gives rise to the control structures found in pseudo-code.</p>
<p>1.5. Program Control Structures<br />
Control Structure<br />
Pseudo code<br />
Flow Chart</p>
<p>Sequence:<br />
In the absence of selection, or repetition, program statements are executed in the sequence in which the appear in the program<br />
1st Instruction</p>
<p>2nd Instruction</p>
<p>3rd Instruction</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Selection<br />
Part of decision making and allows alternative actions to be taken according to the conditions that exist at particular stages in program execution</p>
<p>&nbsp;</p>
<p>IF<br />
condition<br />
THEN<br />
actions<br />
ELSE<br />
actions<br />
ENDIF<br />
Or</p>
<p>&nbsp;</p>
<p>CASE<br />
a). Actions<br />
b). Actions<br />
c). Actions<br />
d). Actions<br />
ENDCASE</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Repetition also called looping<br />
There are many programming problems in which the same sequence of statements needs to be performed again and again for a definite or indefinite number of times</p>
<p>WHILE<br />
condition<br />
DO<br />
Actions<br />
ENDWHILE</p>
<p>&nbsp;</p>
<p>REPEAT<br />
actions<br />
UNTIL<br />
condition</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>1.6. Programming Methods<br />
1.6.1 Top-down and Bottom-up methodology<br />
A top-down approach (is also known as step-wise design) is essentially the breaking down of a system to gain insight into its compositional sub-systems. In a top-down approach an overview of the system is formulated, specifying but not detailing any first-level subsystems. Each subsystem is then refined in yet greater detail, sometimes in many additional subsystem levels, until the entire specification is reduced to base elements. A top-down model is often specified with the assistance of &#8220;black boxes&#8221;, these make it easier to manipulate. However, black boxes may fail to elucidate elementary mechanisms or be detailed enough to realistically validate the model.</p>
<p>Top-down-design starts with a description of the overall system and usually consists of a hierarchical structure which contains more detailed descriptions of the system at each lower level. The lower level design details continue until further subdivision is no longer possible, i.e., until the system is described in terms of its &#8220;atomic&#8221; parts. This method involves a hierarchical or tree-like structure for a system as illustrated by the following diagram:</p>
<p>At the top level, we have that part of the system which deals with the overall system; a kind of system overview or main top-level module.</p>
<p>Top down programming method process<br />
Define exactly what data the program will get and what it has to do with them.<br />
If the task is simple enough, write the program code.<br />
Otherwise, split the task into smaller parts and define exactly the duty of each part and interface to the rest of the program.<br />
Repeat the steps 14 separately for each subtask.</p>
<p>Advantages of the Top-Down Design Method<br />
It is easier to comprehend the solution of a smaller and less complicated problem than to grasp the solution of a large and complex problem. Separating the low level work from the higher level abstractions leads to a modular design. Modular design means development can be self contained. Much less time consuming (each programmer is only involved in a part of the big project).<br />
It is easier to test segments of solutions, rather than the entire solution at once. This method allows one to test the solution of each sub-problem separately until the entire solution has been tested.<br />
It is often possible to simplify the logical steps of each sub-problem, so that when taken as a whole, the entire solution has less complex logic and hence easier to develop. A simplified solution takes less time to develop and will be more readable.<br />
The program will be easier to maintain. If errors occur in the output it is easy to identify the errors generated from each of the modules / sub-programs of the entire program.</p>
<p>A bottom-up approach is the piecing together of systems to give rise to grander systems, thus making the original systems sub-systems of the emergent system. In a bottom-up approach the individual base elements of the system are first specified in great detail. These elements are then linked together to form larger subsystems, which then in turn are linked, sometimes in many levels, until a complete top-level system is formed. This strategy often resembles a &#8220;seed&#8221; model, whereby the beginnings are small but eventually grow in complexity and completeness. However, &#8220;organic strategies&#8221; may result in a tangle of elements and subsystems, developed in isolation and subject to local optimization as opposed to meeting a global purpose.</p>
<p>Top-down is a programming style, the mainstay of traditional procedural languages, in which design begins by specifying complex pieces and then dividing them into successively smaller pieces. The technique for writing a program using top-down methods is to write a main procedure that names all the major functions it will need. Later, the programming team looks at the requirements of each of those functions and the process is repeated. These compartmentalized sub-routines eventually will perform actions so simple they can be easily and concisely coded. When all the various sub-routines have been coded the program is ready for testing. By defining how the application comes together at a high level, lower level work can be self-contained. By defining how the lower level abstractions are expected to integrate into higher level ones, interfaces become clearly defined.</p>
<p>&nbsp;</p>
<p>Top-down approaches emphasize planning and a complete understanding of the system. It is inherent that no coding can begin until a sufficient level of detail has been reached in the design of at least some part of the system. The Top-Down Approach is done by attaching the stubs in place of the module. This, however, delays testing of the ultimate functional units of a system until significant design is complete. Bottom-up emphasizes coding and early testing, which can begin as soon as the first module has been specified. This approach, however, runs the risk that modules may be coded without having a clear idea of how they link to other parts of the system, and that such linking may not be as easy as first thought. Re-usability of code is one of the main benefits of the bottom-up approach</p>
<p>1.6.2. Structured programming Method<br />
Structured programming is a special type of procedural programming. It provides additional tools to manage the problems that larger programs were creating. Structured programming requires that programmers break program structure into small pieces of code that are easily understood. It also frowns upon the use of global variables and instead uses variables local to each subroutine.</p>
<p>Structured programming was developed during the 1950s after Edgar Dijkstras insightful comments into the harmful nature of the GO TO statement. Dijkstra and others subsequently created a set of acceptable structures in programming that would enable development without GO TO statements. These structures produced programs that were easier to read by humans, easier to debug and easier to test. These structures have become some of the founding principles of modern programming methods.</p>
<p>Although the principles of structured programming have had a profound effect on the programming world, it was not until the 1970s that an actual language was created for teaching structured programming. Pascal was developed especially for this purpose, though it is much derided as a toy language, and appears to have never been used in commercial development. It appears that existing languages such as COBOL and FORTRAN were changed to accommodate Dijkstras structures, or that programming included these structures through more indirect methods.</p>
<p>Later generation languages such as C are fully-fledged structured programming languages; these are from the third generation and procedural, in that they are both written and executed step-by-step. C, in its turn, has formed the foundation for the object-oriented language C++.</p>
<p>The three structures allowed in structured programming are sequence, selection, and iteration. Structures are also thought of in terms of substitution and combination, i.e. structures can be substituted or combined with other structures as long as the result equals a sequential structure. Structured programming also pays attention to design and testing with emphasis on a top-down approach. The top-down approach uses modularity as a means to ensure that the program is both legible and manageable, and also that these modules can be tested as they are developed. This is beneficial as it ensures that all modules should be tested and that bugs can be found in the modules that have most recently been added or altered.</p>
<p>Structured programming also places emphasis on program documentation, which can be in the form of a chart or the structured coding/listing. This documentation allows for subsequent updating of modules, making these modules easier to locate in the program. Modularity also ensures greater opportunity for re-use of modules during development.</p>
<p>1.7. Programming Aims<br />
Good programming principles and practice aim at producing a program with the following characteristics;<br />
Reliability: the program can be depended upon always to do what it is supposed to do<br />
Maintainability: the program will be easy to change or modify when the need arises<br />
Portability: the program will be transferable to a different computer with a minimum modification.<br />
Readability: the program will be easy for a programmer to read and understand.<br />
Performance: the program causes the tasks to be done quickly and efficiently.<br />
Storage saving: the program is not allowed to be unnecessarily long</p>
<p>1.8. Programming Paradigms<br />
A programming paradigm is a pattern of problem solving thought that underlies a particular genre of programs and languages. Four distinct and fundamental programming paradigms have evolved over the last three decades;<br />
Imperative programming;<br />
Object-oriented programming<br />
Functional programming<br />
Logic Programming;</p>
<p>1.8.1. Imperative programming;<br />
The oldest and the most well-developed, it emerged with the first computers in the 1940s and its elements directly mirror the architectural characteristics of modern computers as well. The program and its variables are stored together and the program contains a series of commands that perform calculations, assign values to variables, retrieve input, produce out, or redirect control elsewhere in the series.</p>
<p>Procedural abstraction is an essential building block for imperative programming as are assignments, loops, sequences, conditional statements and exception handling. Imperative languages also support variable declaration and expressions. The predominant imperative programming languages include Cobol, Fortran, C Ada and Perl.</p>
<p>Commands are normally executed in the order they appear in the memory, while conditional and unconditional branching statements can interrupt this normal flow of execution. Originally the commands included assignment statements, conditional statements and branching statements. The assignments statements provided the ability to dynamically update the value stored in the memory location, while conditional and branching statements could be combined to allow a set of statements to be either skipped or repeatedly executed. The main features of Imperative programming includes;<br />
Control structures;<br />
Input/output<br />
Error and exception handling<br />
Procedural abstraction<br />
Expressions and assignments<br />
Library support for data structures</p>
<p>1.8.2. Object-oriented (OO) programming:<br />
Provides a model in which the program is a collection of objects that interact with each other by passing messages that transform their state. The message passing allows the data objects to become active rather than passive. Object classification, inheritance and message passing are fundamental building blocks for OO programming. Major languages includes, C++, Java and C# .</p>
<p>1.8.3 Functional Programming:<br />
Emerged in the early 1960s and its creation was motivated by the needs of researchers in artificial intelligence and its sub-fields- symbolic computation, theorem proving, rule-based systems and natural language processing. Models a computational problem as a collection of mathematical functions, each with an input (domain) and a result (range) spaces.</p>
<p>1.8.4. Logic Programming<br />
Logic (declarative) programming allows a program to model a problem by declaring what outcome the program should accomplish, rather than how it should be accomplished. Sometimes called rule-based languages, since the programs declarations look more like a set of rules, or constraints on the problem, rather than a sequence of commands to be carried out.</p>
<p>Chapter Review Questions<br />
Describe the processing of solving a problem using computers<br />
Define a problem Algorithm<br />
What are the advantages and disadvantages of using flow-charts to represent problem algorithm<br />
What are the advantages and disadvantages of representing a problem algorithm using pseudo-codes.<br />
A School is interested in computerizing their students grading system which is as follows;<br />
Marks<br />
Grade</p>
<p>80 &#8211; 100<br />
A</p>
<p>60 &#8211; 79<br />
B</p>
<p>50 &#8211; 59<br />
C</p>
<p>40 &#8211; 49<br />
D</p>
<p>0 &#8211; 39<br />
E</p>
<p>&nbsp;</p>
<p>Draw a flow chart to represent the solution.<br />
Represent the solution in pseudo-code.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codestar.wordpress.com/2018/05/01/introduction-to-c-programming/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">16</post-id>
		<media:content url="https://2.gravatar.com/avatar/b297cad9e7e8e24a970bd9c5b56e621f82d1651f1845cb2b0706d68419e7fcb4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">delta3936</media:title>
		</media:content>
	</item>
	</channel>
</rss>
