Problem Solving and Programming in C

Unformatted text preview:

PROBLEM SOLVING AND PROGRAMMING IN C 224AI1A1CA UNIT I INTRODUCTION TO PROGRAMMING AND PROBLEM SOLVING 1 1 TYPES OF PROGRAMMING LANGUAGES Programming is a way to instruct the computer to perform various tasks Programming languages are primarily classified into three types such as high level languages assembly languages and machine level languages The communication between a computer and a human being is possible by these languages 1 1 1 High level Languages The high level language is a programming language that allows a programmer to write the programs which are independent of a particular type of computer The high level languages are considered as high level because they are closer to human languages than machine level languages High level languages use English language It requires Compiler interpreter which is used to convert high level language into machine language Fortran BASIC C C Java etc are examples of high level languages 1 1 2 Assembly Languages Assembly languages use Mnemonic code like add mul div etc to perform various operations Assembler is needed to convert assembly code into machine code Since assembly language instructions are written in English words like mov add sub so it is easier to write and understand Assembly language is low level language 1 1 3 Machine Level Languages The machine level language is a language that consists of a set of instructions that are in the binary form 0 or 1 No need of any translator for this language It is difficult to write code in machine language It is also known as low level language The set of instructions is known as Program A Collection of programs along with 1 2 SYSTEM SOFTWARE their documentation are called Software Software can be classified as Application Software PROBLEM SOLVING AND PROGRAMMING IN C 224AI1A1CA System Software 1 2 1 Application Software 1 2 2 System Software examples of system software Operating Systems If you want to use a computer for a specific task it needs to be instructed accordingly Such instructions are provided by application software Ms Word Ms Excel Paint and railway reservation system are examples of Application software The software are used to define functioning of any computer or its components are known as system software Operating system compiler interpreter linker editors etc are Operating system OS is system software that helps the users to operate computer efficiently The primary purpose of operating system is to act as an interface between the computer and the user The three main responsibilities of an operating system are o To provide an interface between the user and the computer hardware o To manage the resources of the computer o To provide support for storing and executing other softwares The main categories of Operating System in the marker are Disk Operating System DOS Graphical User Interface GUI based OS called Windows and UNIX based OS DOS DOS was developed in 1981 by Microsoft and named as MS DOS It is a single user single task and command based Operating system GUI based OS The concept of using graphical user interface was actually initiated by Apple computers on their Macintosh machines The users can work with this OS without remember the commands This concept was further extended by launching Windows 3 1 in 1991 which was under MSDOS OS Windows 3 1 is not OS but provided graphical support for many activities After 3 1 Windows 95 was launched by Microsoft in 1995 as on Windows Operating System It is a multi user and multi task operating system This was further PROBLEM SOLVING AND PROGRAMMING IN C 224AI1A1CA improved by Windows 98 Windows 2000 Windows XP Windows ME Windows Vista Windows 7 Windows 8 Windows 8 1 Windows 10 Windows 11 and Windows 365 Unix Based OS It was developed by AT T Bell Labs 1969 It is multi user multi tasking operating system A very useful advantage of the UNIX OS is its Security Unix has become a kind of trademark and there exist many UNIX like OS such as HP UX Sun Solaris and Linux Compiler A Compiler is a program that can read a program in one language called Source language and translate it into an equivalent program in another language called the target language as shown in Figure 1 1 It also reports any errors in the source program during the translation process Figure 1 1 Process of a Compiler If the target program is an executable machine language program it can be called by the user to process inputs and produce outputs The C language uses compiler as a translation program Interpreter An interpreter is another kind of language processor Instead of producing a target program as a translation an Interpreter appears to directly execute the operations specified in the source program on inputs supplied by the user as shown in Figure 1 2 The BASIC language uses interpreter as a translation program PROBLEM SOLVING AND PROGRAMMING IN C 224AI1A1CA Figure 1 2 Process of an Interpreter The machine language target program produced by a compiler is usually much faster than an interpreter because compiler executes the whole source program at a time An interpreter can usually give better error diagnostics than a compiler because it executes the source program statement by statement Java language uses both compiler and interpreter as language translator A Java source program may first be compiled into an intermediate form called byte codes The byte codes are then interpreted by a virtual machine to produce object code to process user s inputs This kind of translator is known as Hybrid Compiler as shown in Figure 1 3 Figure 1 3 A Process of Hybrid Compiler Linker and Loader Large programs are often compiled in pieces so the relocatable machine code may have to be linked with other relocatable object files and library files into the code that actually runs on the machine The linker resolves external memory addresses where the code in one file may refer to a location in another file The loader then puts together all the executable object files into memory for execution PROBLEM SOLVING AND PROGRAMMING IN C 224AI1A1CA 1 3 PROBLEM SOLVING STRATEGIES 1 3 1 Steps involved in problem solving Program writing is a systematic process It is not all about coding only It requires to follow the certain methodology In order to write a program the following steps must be followed 1 Analyse the problem to identify inputs outputs and processing requirements 2 Identify the various processing steps needed to solve the problem and represent them in a particular way such as


View Full Document

Problem Solving and Programming in C

Download Problem Solving and Programming in C
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Problem Solving and Programming in C and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Problem Solving and Programming in C and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?