Examples of Expressions

Tuesday, May 29, 2012
We have already seen the precedence of arithmetic operators. We have expressions for different calculations in algebraic form, and in our programs we write them in the form of C statements. Let’s discuss some more examples to get a better understanding. We know about the quadratic equation in algebra,...

Sample Program

Monday, May 28, 2012
Problem statement: Calculate the average age of a class of ten students. Prompt the user to enter the age of each student. Solution: Lets first sort out the problem. In the problem we will take the ages of ten students from the user. To store these ages we will use ten variables, one for each student’s...

Precedence of Operators

The arithmetic operators in an expression are evaluated according to their precedence. The precedence means which operator will be evaluated first and which will be evaluated after that and so on. In an expression, the parentheses ( ) are used to force the evaluation order. The operators in the parentheses(...

Arithmetic Operators

In C language we have the usual arithmetic operators for addition, subtraction, multiplication and division. C also provides a special arithmetic operator which is called modulus. All these operators are binary operators which means they operate on two operands. So we need two values for addition, subtraction,...

Data Types

A variable must have a data type like integer, decimal numbers, characters etc. The variable of type Integer stores integers and a character type variable stores characters. The primary difference between data types is their size in memory. Different data types have different size in memory depending...

Assignment Operator

The equal-to-sign (=) is used as assignment operator in C language. Do not confuse the algebraic equal-to with the assignment operator. In Algebra X = 2 means the value of X is 2, whereas in C language X = 2 (where X is a variable name) means take the value 2 and put it in the memory location labeled...

Variables

We store every kind of data in variables. Variables are locations in memory for storing data. The memory is divided into blocks. It can be viewed as pigeon-holes. You can think of it as PO Boxes also. In post offices there are different boxes and each has an address. Similarly in memory, there is a...

Our First Program,c++ First program

Sunday, May 27, 2012
Let’s write our first program in C and understand the basics of C program by explaining it line by line. # include main() { cout << "hello!"; } The first line is # include This is preprocessor directive. The features of preprocessor will be discussed later. For the time being take this...

IDE (Integrated Development Environment)

Saturday, May 26, 2012
There are many IDEs provided by different vendors. These IDEs contain editor, compilers, debugger, linker and loader. The benefit of an IDE is that we have all these things at the same place. We write program, compile it and run it at the same place (i.e. in an IDE). But the difficulty is that in an...

Steps involved in writing and executing a program

The following figure represents a graphical explanation of all the steps involved in writing and executing a program. For previous lesson click here: Tools Of Trade For next lesson click here: IDE (Integrated Development Environment) the easiest way to learn programming introduction to programming Steps...

Tools Of Trade

As programmer we need different tools to develop a program. These tools are needed for the life cycle of programs. editors: First of all we need a tool for writing the code of a program. For this purpose we used Editors in which we write our code. We can use word processor too for this, but word processors...

History of C Language

The C language was developed in late 60’s and early 70’s, in Bell Laboratories. In those days BCPL and B languages were developed at Bell Laboratories. The BCPL language was developed in 1967 by Martin Richards as a language for writing operating systems software and compilers. In 1970 Ken Thompson...

types of system softwares

o Operating system o Device drivers o Utilities Operating system: An operating system (sometimes abbreviated as "OS") is the program that manages all the other programs in a computer. It is a integrated collection of routines that service the sequencing and processing of programs by a computer. Note:...

Software Categories

Software is categorized into two main categories: o System Software o Application Software System Software: The system software controls the computer. It communicates with computer’s hardware (key board, mouse, modem, sound card etc) and controls different aspects of operations. Sub categories of system...

Program design recipe

In order to design a program effectively and properly we must have a recipe to follow. In the book name ‘How to design programs’ by Matthias Felleisen.and the co-worker, the idea of design recipe has been stated very elegenlty as “Learning to design programs is like learning to play soccer. A player...

Comment the code liberally

Always comment the code liberally. The comment statements do not affect the performance of the program as these are ignored by the compiler and do not take any memory in the computer. Comments are used to explain the functioning of the programs. It helps the other programmers as well as the creator...

Understand the fact that computers are stupid

Computers are incredibly stupid. They do exactly what you tell them to do: no more, no less-- unlike human beings. Computers can't think by themselves. In this sense, they differ from human beings. For example, if someone asks you, “What is the time?”, “Time please?” or just, “Time?” you understand...

Think about Good user interface

As programmers, we assume that computer users know a lot of things, this is a big mistake. So never assume that the user of your program is computer literate. Always provide an easy to understand and easy to use interface that is self explanatory. For previous lesson click here: Think about the reusability For...

Think about the reusability

When ever you are writing a program, always keep in mind that it could be reused at some other time. Also, try to write in a way that it can be used to solve some other related problem. For previous lesson click here: Paying attention to detail For next lesson click here: Think about Good user interface the...

Paying attention to detail

In programming, the details matter. This is a very important skill. A good programmer always analyzes the problem statement very carefully and in detail. You should pay attention to all the aspects of the problem. You can't be vague. You can't describe your program 3/4th of the way, then say, "You know...

What skills are needed

Programming is an important activity as people life and living depends on the programs one make. Hence while programming one should o Paying attention to detail o Think about the reusability o Think about good user interface o Understand the fact the computers are stupid o Comment the code liberally For...

Why Programming is important

The question most of the people ask is why should we learn to program when there are so many application software and code generators available to do the task for us. Well the answer is as give by the Matthias Felleisen in the book ‘How to design programs’ “The answer consists of two parts. First, it...

What is programming

Definition: "A program is a precise sequence of steps to solve a particular problem.” It means that when we say that we have a program, it actually means that we know about a complete set activities to be performed in a particular order. The purpose of these activities is to solve a given problem. Alan...
 

introduction to programming Copyright © 2011-2012 | Powered by Blogger