Module 1. Introduction to computer planning

Lesson 3

CONCEPTS OF PROGRAMMING LANGUAGE

3.1  Computer Programming Language

The design of modern computing machines parallels the algorithmic nature of most practical applications. The computer operates under the control of a series of instructions that reside in internal storage and are interpreted and executed by the circuitry of the arithmetic and control parts of the machine. The instructions are primitive in nature, each being composed basically of operation and one or more operands or modifiers, and exist in a form chosen for the internal representation of data. Machine instructions that exist in this form are said to be in machine language, since they are numerically coded (in binary codes) and directly executable by a specific computer.

Similarly as both an algorithm and a sequence of machine language instructions is the concept of a computer programme (usually referred to as a programme), which can be defined as follows:

A programme is a meaningful sequence of statements, possessing an implicit or explicit order of execution, and specifying a computer-oriented representation of an algorithmic process.

Statements, in turn, are strings of symbols from a given alphabet, composed of letters, digits, and special characters. The forms of each statement obey a set of rules (syntax) and possess an operational meaning (semantics). Collectively, the alphabet, syntax and semantics are termed as a ‘language’.

Thus, a programming language is a standardised method for expressing instructions to a computer. The language allows a programmer to precisely specify what kinds of data a computer will act upon, and precisely what actions to take under various circumstances. This serves two primary purposes; the first is that the internal representation a computer uses for its data and operations (at the lowest level, i.e., (0, 1) representation/machine language) are not easily understood by humans, so translating a human-readable language into those internal representations makes programming easier. Another purpose is transporting programmes between different computers: those internal representations also differ from one computer to the next, but if each is capable of translating the human-readable language into its own understandable language, then that programme will operate on both.

If the translation mechanism used, translates the programme text as a whole and then runs the internal format, this mechanism is called ‘compilation’. The compiler is, therefore, a programme, which takes the human-readable programme text (called source code or source programme) as data input and produces object code as output. This object code may be machine code directly usable by the processor, or it may be code matching the specification of a virtual machine, and run under that environment.

If the programme text is translated step by step at runtime, with each translated step being executed immediately, the translation mechanism is known as an interpreter.  Interpreted programmes run usually more slowly than compiled programmes, but have more flexibility because, they are able to interact with the execution environment (e.g., Disk Operating System – DOS environment), instead of all interactions being planned beforehand by the programmer.

Many languages can be either compiled or interpreted, but most are better suited for one than the other.

3.1.1  Low level languages

A low level programming language is a programming language that provides little or no abstraction from a computer’s instruction set architecture. Generally, this refers to either machine code or assembly language. In present context, the word “low” indicates small or no amount of abstraction between the language and machine language. Thus, low level languages are sometimes described as being “close to the hardware”.

Low Level Languages (LLL) can be converted to machine code without using a compiler or interpreter; and the resulting code runs directly on the processor. A programme written in a low level language runs faster as well as occupies a small amount of computer’s memory as compared to an equivalent programme written in a high level language. Low level languages are simple, but are considered difficult to use, due to the numerous hardware details that the programmer must know prior to writing a code.

3.1.1.1  Machine language

Machine language is the programming language that the computer understands, i.e., its native language. Machine language comprises the numeric codes for the operations that a particular computer can execute directly. These codes are strings of binary digits (“bits”), i.e., 0’s and 1’s. Typically, machine language instructions use some bits to represent operations like addition or subtraction; while some of these bits represent operands or perhaps the location of the next instruction, etc. Machine language is difficult to read and write by the human beings as it does not resemble natural language or conventional mathematical notations. Moreover, machine language codes vary from computer to computer! Hence, machine languages instructions correspond to the instruction set of particular hardware architecture and are machine dependent, i.e., different computers use different machine languages; however, every machine language supports instructions for basic operations such as addition and subtraction. The instructions are patterns of 0’s and 1’s in lengths of 16, 24, 32 or 64 bits. As stated earlier, each instruction has two parts: an operator and an operand. The operator is the first few bits of the instruction. It specifies the operation to be performed, such as movement of data between memory, the storage address and the Central Processing Unit (CPU). The remaining bits constitute the operand. The operand is usually an address of a memory location containing the data to be operated upon. Each address is 8-bit long and referred to as a word. Each machine language instruction is very simple and by itself accomplishes very little. However, the CPU has the ability to execute millions of instructions per second.

Though machine language is the most efficient programming language in terms of execution, it has various drawbacks. Programming in machine language is tedious and error-prone. The use of numeric codes to represent instructions is difficult and makes programming a complex and arduous task. This complexity results in programmes that are difficult to read and even more difficult to debug. Besides, machine language requires the programmer to keep track of where individual bits of data are stored in the computer’s memory. Even inserting new instructions or changing the address of one bit of data affects the correctness of the programme and the subsequent memory addresses used in the rest of the programme. Machine language programmes are very long as each instruction merely accomplishes a small task, e.g., to multiply two numbers could require more than 10 instructions in machine language. These drawbacks make programming in machine language difficult and uneconomical. Such difficulties have given rise to the development of other languages.

3.1.1.2  Assembly language

Assembly language is one level above the machine language. It uses short mnemonic codes for instructions and allows the programmer to define names for blocks of memory that hold data. For instance, one might write a typical assembly language statement for an instruction that adds two numbers as “ADD pay, total” instead of the machine instruction like “0110101100101000”.

Assembly language is designed to be easily translated into machine language. Although blocks of data may be referred to by name rather than their machine addresses, assembly language does not provide more sophisticated means of organising complex information like machine language; assembly language requires detailed knowledge of particular internal computer architecture. It is useful when such details are important, as in programming a computer to interact with input/output devices (i.e., printers, scanners, storage devices, and so forth).

3.1.2  High level languages

High level programming languages allow the programmer to focus on the problem rather than concentrating on how the computer software and hardware interact to solve the problem. These programmes are designed for ease and reliability while machine language is designed for efficient execution. With the advent of High Level Languages (HLL), most programmers have very little use for machine language to write programmes. However, programmers still need to understand machine language. Knowledge of machine language is essential for the programmers who are responsible for maintaining existing machine language codes and creating assemblers. Besides, there are certain tasks that can be best accomplished through machine language.

3.2  Computer Programming Paradigms

3.2.1  Procedural programming

This is a method of programming based upon the concept of the unit and scope (the data viewing range of an executable code statement). A procedural programme is composed of one or more units or modules, either user coded or provided in a code library; each module is composed of one or more procedures, also called a function, routine, subroutine, or method, depending on programming language. It is possible for a procedural programme to have multiple levels or scopes with procedures defined inside other procedures. Each scope can contain variables, which cannot be seen in outer scopes.

Procedural programming offers many benefits over simple sequential programming: procedural programming code is easier to read and more maintainable; procedural code is more flexible; procedural programming allows for the easier practice of good programme design.

3.2.2  Structured programming

Structured programming is a programming paradigm that aims at improving the clarity, quality and development time of a computer programme by making extensive use of subroutines, block structures and for and while loops, in contrast to using simple tests and jumps such as the goto statement as stated earlier, which could lead to “spaghetti code” making it both difficult to follow and to maintain. This paradigm emerged way back in the 1960’s and was bolstered theoretically by the Structured Programme Theorem, and practically by the emergence of languages such as ALGOL, ‘C’, Pascal, PL/1, etc. The structured programme theorem states that every computable function can be implemented in a programming language that combines sub-programmes in only three specific ways:

·         Executing one sub-programme, and then another sub-programme (sequence);

·         Executing one of two sub-programmes according to the value of a Boolean variable (selection); and

·         Executing a sub-programme until a Boolean variable is true (repetition).

This can be seen as a subset or sub-discipline of procedural programming, one of the major paradigms (and probably the most popular one) for programming computers. It is possible to do structured programming with almost any procedural programming language. Hence, at the level of relatively small pieces of code, structured programming typically recommends simple, hierarchical programme flow structures, viz., sequence, selection and repetition. These can be obtained in most modern languages by using only structured control (looping and branching) constructs, usually, named while…do , repeat … until, for, and if …then …else. Often, it is recommended that each structured element should only have one entry point and one exit point, and a few languages enforce this.

Programmers should break larger pieces of code into shorter subroutines (functions and procedures in some languages) that are small enough to be understood easily. In general, programmes should use global variables carefully; instead, subroutines should use local variables and take arguments either by value or by reference (to be discussed later). These techniques help to make isolated small pieces of code easier to understand without having to understand the whole programme at once.

Structured programming is often (but not always) associated with a top-down approach to design. In this way, designers map out the large scale structure of a programme in terms of smaller operations, implement and test the smaller operations, and then tie them together into a whole programme.

By the end of the 20th century, the vast majority of serious programmers endorsed structured procedural programming. They claim that a fellow can understand a structured programme more easily, leading to improved reliability and easier maintenance. Attempts to actually measure this have been rare, and there is a suspicion in some circles that the benefits are real but small. Further, designers have created new paradigms loosely based on procedural programming that accept the lessons of structured programming but attempt to go beyond this in providing structure for data as well as for programme flow. Object-Oriented Programming (OOP) in most cases can be seen as an example of this, although there are also some object-oriented variants that are not procedural.

You know that unstructured languages define control flow largely in terms of a goto statement that transfers execution control to a label in code. Structured programming languages provide special constructs for creating a variety of loops and conditional branches of execution, although they may also provide a goto statement so as to reduce excessive nesting of cascades of if structures, especially for handling exceptional conditions.

To be more precise, any code structure should have only one entry point and one exit point in a structured programming language. Many languages such as ‘C’, allow multiple paths to a structure’s exit (such as continue, break and return) which can bring advantages in readability.

3.2.3  Object-oriented programming

It is a software design methodology that defines programmes in terms of ‘objects’, which are entities that combine both state (i.e., data) and behaviour (i.e., procedures or methods). Object-oriented programming expresses a programme as a set of these objects, which communicate with each other to perform tasks. This differs from traditional procedural languages in which data and procedures are separate and unrelated. These methods are intended to make programmes and modules easier to write, maintain and reuse.

Another way this is often expressed is that object-oriented programming encourages the programmer to think of programmes primarily in terms of the data types, and secondarily on the operations (‘methods’) specific to those data types. Procedural languages encourage the programmer to think primarily in terms of procedures, and secondarily the data that those procedures operate on. Procedural programmers write functions, and then pass data to them. Object-oriented programmers define objects with data and methods then send messages to the objects telling them to perform those methods on themselves.

The following four features are most important for an OOP language:

·        Abstraction: Each object in the system serves as a model of an abstract ‘actor’ that can perform work, report on and change its state, and ‘communicate’ with other objects in the system, without revealing how these features are implemented.  Processes, functions or methods may also be so abstracted, and when they are, a variety of techniques are required to extend an abstraction.

·        Encapsulation: Also called ‘information hiding’, this ensures that objects cannot change the internal state of other objects in unexpected ways; only the object's own internal methods are allowed to access its state.  Each type of object exposes an interface to other objects that specifies how other objects may interact with it. Some languages relax this, allowing some direct access to object internals in a controlled way, and limiting the degree of abstraction.

·        Polymorphism: References to and collections of objects may contain objects of different types, and invoking a behaviour on a reference will produce the correct behaviour for the actual type of the referent.  When it occurs at "run time", this latter feature is called ‘late binding’ or ‘dynamic binding’. Some languages provide more static (compile time) means of polymorphism such as C++ templates and operator overloading.

·        Inheritance: Organises and facilitates polymorphism and encapsulation by permitting objects to be defined and created that are specialised types of already-existing objects - these can share (and extend) their behaviour without having to re-implement that behaviour. This is typically done by grouping objects into ‘classes’, and classes into ‘trees’ or ‘lattices’ reflecting common behaviour.

Just as procedural programming led to refinements of technique such as structured programming, modern object-oriented software design methods include refinements such as the use of design patterns, design by contract, and modelling languages (such as UML).

3.3  Programming Languages for Scientific and Business Computing

FORTRAN  

The name ‘Fortran’ is an abbreviation of the phrase ‘Formula Translation’. The language was originally known as FORTRAN. With the advent of ‘Fortran 90’, the capitalisation has been abandoned. The published formal standards use “Fortran”.

This programming language was developed in 1950s by a team lead by John W. Backus whilst he was at IBM; and it is still in use today! This compiler was the first compiler for any HLL, and was actually an optimising compiler, because the authors were worried that no one would use the language if its performance was not comparable to assembly language.

It is a procedural language mainly used for scientific computing and numerical analysis. Owing to the heavy use by scientists involved in numerical work, the language grew in ways that encouraged compiler writers to produce compilers that generated high quality (efficient) code. There are many high performance compiler vendors.  Much work and research in compiler theory and design was motivated by the need to generate good code for Fortran programmes.

Several revisions of the language have appeared, including the very well known FORTRAN IV (the same as FORTRAN 66), FORTRAN 77 and Fortran 95.  The most recent formal standard for the language is known as FORTRAN 2003.

Initially, the language relied on precise formatting of the source code and heavy use of statement numbers and GOTO statements. Every version introduced ‘modern’ programming concepts such as source code comments and output of text; IF-THEN-ELSE (in FORTRAN 77); recursion (in Fortran 95); etc. Of late, Fortran 2003 supports several new feature as exception handling; allocatable components and dummy arguments; interoperability with ‘C’; object-orientation including procedure pointers and structure components, structure finalisation, type extension and inheritance; and polymorphism.

 

Vendors of high performance scientific computers such as Burroughs, CDC, CRAY, IBM, Texas Instruments, etc., added extensions to FORTRAN to make use of special hardware features like instruction cache, CPU pipeline, vector arrays, etc.  For example, one of IBM's FORTRAN compilers had a level of optimisation, which reordered the machine code instructions to keep several internal arithmetic units busy at a time. Another example is the special ‘version’ of FORTRAN designed specifically for the ILLIAC IV supercomputer installed at the NASA’s Ames Research Centre. All such extensions have disappeared with the passage of time. However, a few major extensions as OpenMP and CoArray Fortran are operational, which facilitate shared memory programming and parallel programming, respectively.

BASIC

BASIC is a general-purpose HLL whose design philosophy emphasises ease of use. Its name is an acronym from Beginner’s All-purpose Symbolic Instruction Code. The BASIC was originally designed by John George Kemeny and Thomas Eugene Kurtz in 1964 at Dartmouth College in New Hampshire, USA to provide computer access to non-science students as the use of computers required writing custom software at that time; which restricted computers’ use only to the scientists and mathematicians. It is an interpreter-based language. The language and its variants became widespread on microcomputers in the late 1970s and 1980s.

BASIC remains popular in numerous dialects and new languages influenced by BASIC such as Microsoft Visual Basic. A large group of developers for the .NET framework uses Visual Basic .NET as their programming language.

COBOL

COBOL is an HLL developed by the Conference on Data Systems Languages (CODASYL) Committee in 1960. Subsequently, the responsibility for developing new COBOL standards has been assumed by the American National Standards Institute (ANSI). Three ANSI standards for COBOL have been produced in 1968, 1974 and 1985.

The word COBOL is an acronym that stands for COmmon Business Oriented Language. As the expanded acronym indicates, COBOL is designed for developing business, typically file-oriented, applications. It is not designed for writing systems programmes. For instance, you would not develop an operating system or a compiler using COBOL.


Conventionally, COBOL is a simple language with a limited scope of function having no pointers, no user-defined functions and no user-defined types. It encourages a simple straightforward programming style. Despite these limitations, COBOL has proven itself to be well suited to business computing. Most COBOL programmes operate in a domain where the programme complexity lies in the business rules that have to be encoded rather than in the sophistication of the data structures or algorithms required.

Now, the Object-Oriented COBOL (OO-COBOL) has been developed that retains all the advantages of previous versions but now includes: user-defined functions; object orientation; national characters – Unicode; multiple currency symbols; cultural adaptability (locales); dynamic memory allocation (pointers); data validation; binary and floating point data types; user-defined data types. Hence, using these OO-COBOL constructs one can write well structured programmes.

COBOL is non-proprietary, i.e., its standard does not belong to any particular vendor. The ANSI COBOL committee legislates formal, non-vendor-specific syntax and semantic language standards.

A typical COBOL programme comprises the four divisions, which divide it into distinct structural elements. Although some of the divisions may be omitted, the sequence in which they are specified is fixed, and must follow the order below:

·         IDENTIFICATION DIVISION. Contains programme information

·         ENVIRONMENT DIVISION. Contains environment information

·         DATA DIVISION. Contains data descriptions

·         PROCEDURE DIVISION. Contains the programme algorithms.

C

‘C’ programming language (called ‘C’ now onwards) is a general purpose procedural computer programming language developed in 1972 by Dennis Ritchie at the AT&T Bell Laboratories, New Jersey (USA) for use with the UNIX operating system. It is one of the most widely used programming languages especially for writing system software such as operating systems and compilers. Besides, it is commonly used for writing a wide variety of scientific and industrial applications including process automation for the dairy plants and dairy farms via embedded microcontrollers, Programmable Logic Controller (PLC), etc. ‘C’ has greatly influenced many other popular programming languages, most notably C++, which began as an extension to ‘C’.

‘C’ is a procedural language for systems implementation. It was designed to be compiled using a relatively straightforward compiler to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. Thus, ‘C’ was useful for many applications that had formerly been coded in assembly language.

Besides its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written ‘C’ programme can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a large range of platforms, from embedded microcontrollers to supercomputers.

Similarly as most procedural languages, ‘C’ facilitates structured programming as well as allows lexical variable scope and recursion. In ‘C’, the entire executable code is embedded in subroutines know as ‘functions’. Function parameters are always passed by value. Pass-by-reference is simulated in ‘C’ by explicitly passing pointer values. ‘C’ source programme’s text is free-format, using the semicolon as a statement terminator and curly braces for grouping blocks of statements.

C++

C++ (pronounced ‘see plus plus’) is an OOP language based on ‘C’, developed by Bjarne Stroustrup at Bell Labs in the 1980s. The name of the language written as C++ signifies the fact that the language evolved from ‘C’. This name was suggested by Rick Mascitti in 1983. Earlier the language had been referred to simply as ‘C with Classes’. The C++ language as an enhancement to the ‘C’ language introduced many novel features such as classes, virtual functions, operator overloading, multiple inheritance, templates and exception handling, etc. The C++ language was standardised by ISO as ISO/IEC 14882:1998: Programming Language C++ Standard way back in September, 1998. The standard further evolved with the standardisation of language and library extensions. The current standard for C++ programming language was ratified and published by ISO in September, 2011 as ISO/IEC 14882:2011 (informally known as C++11).

C++ is one of the most popular programming languages with application domains including systems software; application software; device drivers; embedded software; high-performance server and client applications; entertainment software such as video games; and hardware design. Several groups provide both free and proprietary C++ compiler software including the GNU Project, Microsoft, Intel, etc. C++ has greatly influenced many other popular programming languages, mainly C# (pronounced as ‘see sharp’) and Java.

Java

Java is an HLL like ‘C’ and Visual Basic, but Java compilers differ from most other compilers in that they produce compiled binary instructions not for the target computer hardware machine, but for an abstract computer platform called the Java Virtual Machine (JVM). Actually, JVM does not exist in hardware. Instead, the binary instructions are executed not by the processor of a computer, but by a computer programme that emulates this theoretical machine. For instance, while the binary code generated by the C++ language compiler will vary for Intel-processor based computers, Macintosh computers and Solaris based computers, the binary codes produced by the Java compiler are the same on all the three platforms. The programme that interprets those binary statements is the only thing that varies. Hence, Java facilitates programmers to write a programme and compile it on any platform, and feel confident that the compiled code runs without change on any other computer platform. This is the promise of “write once, run anywhere,” that makes Java such a persuasive language for application development. Of course, this portability comes at a price. You cannot expect a programme, which interprets the binary instructions to run as fast as an actual computer that executes these instructions directly, i.e., Java programmes run relatively slower than the programmes written in compiled languages. However, there have been a number of techniques applied to Java interpreters to make them more competitive in speed. Java Just-In-Time (JIT) compilers are the general solution to this problem. These compilers identify the spots in a programme while it is running that can benefit by being optimised and carefully restructure the code or compile little pieces of it into machine language as it is executed so that if that segment is run repetitively its speed will approach that of compiled languages. The first significant JIT compilers were from Symantec (now Webgain) and Microsoft. Microsoft seems to have abandoned this work, but the Symantec JIT compiler is widely available. More recently, both Sun and IBM have introduced JIT compiler systems, which are quite powerful. Sun’s compiler is referred to as its Hot Spot compiler and is provided with the Windows and Solaris versions of Java 1.3. The primary characteristics of Java language are as follows:

·         Java is a true object-oriented language. It uses the principles of abstraction, encapsulation and inheritance. It is largely based on the notion of classes.

·         Java language makes it very easy to develop concurrent processes, which execute simultaneously within an application. This is called multithreading. The multithread mechanism provides rich functionality to applications. For example, a user may need to fill in a form while printing a document. Also, multithreading enables Java function on multi-processor machines. Though some other languages provide the multithreading mechanism, but they use non-standard external libraries to accomplish it. Java integrates this capability directly into the language, which provides greater portability with Java programmes.

·         Links are not edited in Java. Link editing is the step after compilation to link external libraries. In Java, the existence of libraries is verified during compilation and code is loaded from these libraries when the programme is executed. This decreases the size of executable codes and makes it possible to optimise the loading of libraries. Any reference to a library requires that it be accessible at the time of compilation. However, the most significant contribution of dynamic linking is that it allows the creation of applications that can be extended dynamically by simply adding new classes, without requiring possession of the source code.

·         Java has a garbage collector, which is a mechanism that clears memory of all objects that are no longer being used. In ‘C’ and C++ programmes, developers must handle the destruction of created objects themselves. This method of managing memory in these programmes requires many lines of code and a lot of fine-tuning. The pointer concept no longer exists in Java.

·         All Java applications run in a secure environment. The virtual machine performs very strict verification of Java code before it is executed. Code cannot bypass the protection mechanisms imposed by the language. For example, a class cannot access a field of another class that has been declared private. The code also cannot try to define pointers to directly access memory. Higher-level verifications are performed by browsers, e.g., an applet cannot access machine resources.

·         The syntax of Java language is simplified and based on C++. The absence of pointers and memory management through the garbage collector as well as the requirement that all developments must use objects, make application code much easier to read. However, developers must yet understand and integrate the hierarchy of the object model of Java Application Programming Interfaces (API).

·         Portability is the most argued topic when discussing Java. In reality, this characteristic is not related to the language itself, but rather to the runtime environment (the virtual machine) of Java programmes. There are currently virtual machines for Unix, Linux, Windows and Macintosh platforms. Nevertheless, the only guarantee for portability in an application is effective testing because problems can still occur between the different platforms.

·         The Sun product distinguishes between two types of platforms. The first is the Java Base Platform, which improves as new API are published and integrated by Sun. The second is the Java Embedded Platform. This is a specialised embedded platform for terminals or peripherals with a minimal graphical interface (in fact, no graphical interface) and is executed using less than 0.5 MB. The Java Base Platform is a complex construction of Java libraries and classes. The key element of this platform is the runtime environment of Java applications, the virtual machine. This is the ‘system’ layer, which communicates with the operating system and provides application portability. The Java virtual machine is actually a runtime environment that interprets resource files (bytecode) or p-code in its own environment.

3.3  ‘C’ Programme Compilation

‘C’ programming language is a free-form language, i.e., the ‘C’ compiler allows you to write a statement anywhere on the line. Generally, ‘C’ statements are written in lowercase letters. However, uppercase letters are used for symbolic constants (to be discussed later).

The Borland Turbo C++ 3.0 compiler is used in this e-course. You may freely download this software from the World Wide Web (WWW) and install it on the appropriate hard drive and folder (say, on the D:\TC) of your computer system. After successful installation, you will find several sub-folders existing under the folder ‘TC’ on D drive. The executable command to start the C++ software is, TC.EXE, which is available under the sub-folder D:\TC\BIN. Hence, initiate the C++ software by running D:\TC\BIN\TC.EXE command at START►RUN under MS-Windows operating system. 

Now, running (or executing) a ‘C’ programme involves the following sequence of steps:

i)        Creating the programme

ii)      Compiling the programme

iii)    Linking the programme with functions that are needed from the ‘C’ library

iv)    Executing the programme.

For illustration, consider the following simple ‘C’ programme that displays the slogan

‘I Love My India!’ onto the computer monitor.

/*

* File: India.c

* -------------

* This simple C programme prints out the slogan, "I Love My India!".

*/

#include <stdio.h>

void main

{

    printf("I Love My India!\n");

}

You may write this ‘C’ programme using the Notepad and save it with the extension as .c rather than the Notepad default extension, .txt (say, India.c). Alternatively, you may write the same code using the in-built editor provided by many compilers such as the Borland Turbo C++ 3.0 compiler.

Run the C++ software as described above and compile the programme, India.c by clicking on the ‘Compile’ option on the toolbar and further selecting ‘Compile’ sub-option. If the programme is grammatically (or syntactically) correct, the message – “Success: Press any key” is flashed by the compiler, otherwise several errors may appear at the bottom, which must be corrected in order to execute the code.  

After successful compilation of the programme, click on the ‘Run’ option on the toolbar to execute the programme. As a result, the slogan, “I Love My India!” appears on the computer monitor, which can be viewed by clicking on the option ‘File’ on the toolbar and selecting the ‘DOS Shell’ sub-option. After viewing the slogan, type the command ‘exit’ at the DOS prompt to come back to the C++ software. You may quit the C++ software and come back to MS-Windows operating environment by clicking toolbar-option ‘File’ followed by sub-option ‘Quit’.