Aug 31, 2013

What is a program?

Unknown | 3:59 PM | Be the first to comment!
A program is a sequence of instructions that specifies how to perform a computation. The computation might be something mathematical, such as solving a system of equations or finding the roots of a polynomial, but it can also be a symbolic computation, such as searching and replacing text in a document or (strangely enough) compiling a program.

The details look different in different languages, but a few basic instructions appear in just about every language:

Input: Get data from the keyboard, a file, or some other device.

Output: Display data on the screen or send data to a file or other device.

Math: Perform basic mathematical operations like addition and multiplication.

Conditional execution: Check for certain conditions and execute the appropriate code.

Repetition: Perform some action repeatedly, usually with some variation.

Believe it or not, that’s pretty much all there is to it. Every program you’ve ever used,
No matter how complicated, is made up of instructions that look pretty much like these.
So you can think of programming as the process of breaking a large, complex task into
smaller and smaller subtasks until the subtasks are simple enough to be performed with
one of these basic instructions.
That may be a little vague, but we will come back to this topic when we talk about algorithms.
Read more ...

Aug 30, 2013

How to create a Batch Program

Unknown | 3:42 PM | 1 Comment so far
Batch file programming is the native programming offered by the Microsoft Windows Operating
System. The batch file is created using any text editors like notepad, WordPad, WinWord or so on, which comprises of a sequence of built-in commands used to perform some often done tasks like deleting a series of files of the same type or of different type, creating logs, clearing unwanted craps from your computer and even for creating a batch VIRUS.


Whenever a Batch program is executed, it was interpreted line-by-line by the CLI (Command
Line Interpreter) command.com or the cmd.exe. The batch file is really helpful in automating tedious tasks and for maintaining system logs. The commands used while creating a batch file are case insensitive, in the sense that it may accept both small and upper case letters.

How to create a Batch Program:

As said earlier, batch programs can be written using any of the text editors such as notepad, wordpad and so on, but notepad is the most often used text editors in such cases. Like any other programing languages, lets start our first program with the ‘Hello World’ program.
1. Open up a notepad and type the following.

@echo off
Echo Hello World
pause
2. Save the file with any name you wish, but make sure that you save the file extension with .bat, in this case I am saving this file as file.bat’.

3. When you save the batch file, then the icon becomes like the left icon,
In Windows XP, the Batch file icon looks like right, whereas in Windows Vista the Icon looks like the below image,




4. Just double click to execute the batch file that you have created now. And the output looks like,

5. Congratulations! You're well on your way to becoming a Batch programmer.

Let me explain what does the above given program does,
echo is the command used to print text on the screen, so whatever that follows the echo
command will be displayed on the output screen. This command is just like the printfstatement in the C language.
When you type the echo command alone, then it will tell you whether the ‘echo is ON’ or ‘echo is OFF’.
It’s always recommended to turn the echo off, else it will display the prompts like (C:\>) and so on. In order to avoid the prompts being displayed, the echo is turned off by using the command “@echo off” or simply by using the “echo off”.

“Echo Hello World” will display the “Hello World” on the output screen, and the pause command is used to wait for the user interaction, whether to proceed further or not. If the pause is not used, then the batch will terminate immediately after displaying the “Hello World”.
Read more ...

Aug 29, 2013

What is C/C++ and why use C/C++?

Unknown | 4:44 PM | Be the first to comment!
What is C/C++:


C++ is a modern, high-level programming language leveraged by millions of programmers around the world. It’s one of the most popular languages for writing computer applications.

In the early days of computing, programs were written in machine language, which consists of the primitive instructions that can be executed directly by the machine.

Machine-language programs are difficult to understand, mostly because the structure of machine language reflects the design of the hardware rather than the needs of programmers. In the mid-1950s, a group of programmers under the direction of John
Backus at IBM had an idea that profoundly changed the nature of computing. Would it be possible, they wondered, to write programs that resembled the mathematical formulas they were trying to compute and have the computer itself translate those formulas into machine language? In 1955, this team produced the initial version of Fortran (whose name is an abbreviation of formula translation), which was the first example of a higher level programming language. Since that time, many new programming languages have been invented.


C++ represents the coming together of two branches in the evolution of programming languages. One of its ancestors is a language called C, which was designed at Bell Laboratories by Dennis Ritchie in 1972 and then later revised and standardized by the American National Standards Institute (ANSI) in 1989. But C++ also descends from another line of languages that have dramatically changed the nature of modern programming.


Why use C/C++:

C /C++ are one of the most widely used third generation programming languages. Its power and flexibility ensure it is still the leading choice for almost all areas of application, especially in the software development environment.

Many applications are written in C or C++, including the compilers for other programming languages. It is the language many operating systems are written in including Unix, DOS and Windows. It continues to adapt to new uses, the latest being Java, which is used for programming Internet applications.

C has many strengths, it is flexible and portable, it can produce fast, compact code, it provides the programmer with objects to create and manipulate complex structures (e.g classes in C++) and low level routines to control hardware (e.g input and output ports and operating system interrupts). It is also one of the few languages to have an international standard, ANSI C.
Read more ...

Aug 28, 2013

Creating Python programs

Unknown | 2:08 PM | Be the first to comment!
Welcome to Python!
This post will show you how to start writing programs.
Python programs are nothing more than text files, and they may be edited with a standard text editor Program (Sometimes, Python programs are distributed in compiled form. We won't have to worry about that for quite a while.). What text editor you use will probably depend on your operating system: any text editor can create Python programs. It is easier to use a text editor that includes Python syntax highlighting.

However,

The first program that every programmer writes is called the "Hello, World!" program. This program simply outputs the phrase "Hello, World!" and then ends. Let's write "Hello, World!" in Python.


Open up your text editor (ex: Notepad) and create a new file called hello.py containing just this line (you can copy-paste if you want):

print("Hello, world!")
ordef hello(message):
message = "Hello, world!"print(message)
return message
print(hello("message"))
This program uses the print function, which simply outputs its parameters to the terminal. Print ends with a newline character, which simply moves the cursor to the next line.
Now that you've written your first program, let's run it in Python! This process differs slightly depending on your operating system.

You can also write directly on Python (Python Graphical User Interface). Just open IDLE (Python GUI) and write down:

Print(”Hello, World!”)
And press ‘Enter’ button.
The program should print:
Hello, world! 
Congratulations! You're well on your way to becoming a Python programmer.
Read more ...
Twitter Delicious Facebook Digg Stumbleupon Favorites More

Search