Programming Practical

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 44

CAP173

PROGRAMMING
METHODOLOGIES -
LABORATORY
Lecture #0
The kick start session
Course details
LTP – 0 0 2
[Two Practical/week]
Credits: 1
Text books:
C:THE COMPLETE REFERENCE BY SCHILDT AND
HERBERT, MC GRAW HILL

PROGRAMMING IN ANSIC, 6TH EDITION by E.


BALAGURUSAMY, MC GRAW HILL

LET US C BY Yashavant P. Kanetkar


Course Assessment Model
Marks break up
Attendance 5
CAP 45
ETE 50
Total 100
Course Outcome
Through this course students should be
able to

 CO1 :: understand how programming


concepts relate to algorithms.
 CO2 :: apply different operations that can be
performed on a file.
 CO3 :: analyze how to compile, debug, run
and test programs.

 CO4 :: develop the logic which will help to


create programs and applications.
The course contents
Introduction to Programming
Data Types and Operators
Control Statements and Decision
Making
Functions
Introduction to Arrays
File Handling
Acknowledgements
The Khan Academy
EdX
Coursera
programmingsimplified.com
cprogramming.com
learn-c.org
Computer programming
Computer programming is the process of
designing and developing various
computer programs to complete specific
tasks in either application or software or
within the computers.

Computer programming is process of


creating a series of programs to resolve a
problem in a computer.
The programming also has another name called
"coding" and the person who writes the code is
referred as the "Programmer" or "Coder".
Why Is Computer
Programming
Important?
Computer programming is the
lifeblood of modern life.
Imagine for a moment
what would happen if all
computers suddenly
disappeared tomorrow. No
internet. No data. No
connection. No
convenience.
•Over the past few decades, computer
programming has played an important
role in the development of the modern
computer and the information age that
we live in today.

•It has allowed us to create new


computer software and systems that
make many aspects of our lives easier.

•Computer Programming allows us to


create new internet-based applications
and services that make it possible for us
Programming Language
• As we know, to communicate with a person, we
need a specific language, similarly to
communicate with computers, programmers
also need a language is called Programming
language.

• A programming language is a computer


language that is used by programmers
(developers) to communicate with
computers.
It is a set of instructions written in any specific
language ( C, C++, Java, Python) to perform a
specific task.
A programming language is mainly used
Programming
Methodology
A programming methodology is
concerned with:
The analysis of a problem by
developing algorithms based on
modern programming techniques

Designingprograms in appropriate
languages and

Implementation on a suitable
platform
C Programming Language
C is a general-purpose, procedural, high-level
programming language used in the
development of computer software and
applications, system programming, games,
web development, and more.

C language was developed by Dennis M.


Ritchie at the Bell Telephone Laboratories in
1972. It is a powerful and flexible language
which was first developed for the programming
of the UNIX operating System.
C is one of the most widely used
programming language.

C programming language is known for


its simplicity and efficiency. It is the
best choice to start with programming
as it gives you a foundational
understanding of programming.
Software Used for programming
TurboC
Code Block
How to install Turbo C++
Step Download Turbo C++ 3.2 from here
1 DOWNLOAD TURBO C++
Step If any previous version of "Turbo C++" install
2 on your computer, then first of all uninstall
that.
Step Extract downloaded "Turbo C++ 3.2.zip" file.
3
Step Run the "setup.exe" file.
4
Step Follow the setup instructions.
5
Step If any error occurs, please check the
6 solution of common Turbo C++ issues here.
How to use Turbo C++
System Requirement

Operating System Pre-Requirement


Windows 11, 10, 8.1 No Pre-Requirement
and 8
Windows 7, Vista and .NET 4.5 Framework
XP Required
How to Install Code Block
Follow the below steps to install Code Blocks for C++
on windows:
Step 1: Open Your Web Browser
Step 2: Go to the Search Panel and Search for “Code
Blocks”

Step 3: Click on the First Result shown on the Search


Engine or click on this link.
Step 4: Click on the “Downloads”
Section.
Step 5: Click On “Download the binary
release”.
Step 6: As per this Date, the Latest Version of
Code Blocks is 20.03. Now here you’ll find
several download options

I’ll suggest you download the file with MinGW


written on it (“codeblocks-20.03mingw-
setup.exe”) as MinGW is a Compiler that is
needed to run the Program. If you download the
normal setup file then you have to download
Step 7: Click on Sourceforge.net under the Download
Section of your desired file.
Step 8: then Download should begin within some
seconds.

Step 9: When the download is completed, Open


Your Code Blocks Setup File.
Step 10: Click on Next.
Step 11: Click on I agree.
Step 12: Click On Next ( you need to have at least
600 MB free storage on your drive for the installation).
Step 13: Select your Destination and Click on Install
Step 14: Once Installation gets completed, click on
Next and then Click on Finish

Now You Code Blocks have been installed.


Printing of Messages on the
screen

Line 1: #include <stdio.h> is a header file library that lets us


work with input and output functions, such as printf() (used in line
4). Header files add functionality to C programs.

Line 2: Another thing that always appear in a C program, is main().


This is called a function. Any code inside its curly brackets {} will
be executed.

Line 4: printf() is a function used to output/print text to the


screen. In our example it will output "Hello World!".
Printing of Messages in
multiple lines

New Lines
The newline character ( \n ) is called an escape sequence, and
it forces the cursor to change its position to the beginning of the
next line on the screen.
Printing of Messages with
tab space
Horizontal tab (\t)
We use it to shift the cursor to a couple of spaces to the right in the
same line.
printf() and scanf() in C
The printf() and scanf() functions are used for input and
output in C language. Both functions are inbuilt library
functions, defined in stdio.h (header file).

printf() function
The printf() function is used for output. It
prints the given statement to the console.
The syntax of printf() function is given below:

The syntax of printf() function is given below:

printf("format string",argument_list);
The format string can be %d (integer), %c (character),
%s (string), %f (float) etc.
scanf() function
The scanf() function is used for input.
It reads the input data from the console.

Syntax

scanf("format string",argument_list);
Example

scanf("%d",&number)

statement reads integer number from the


console and stores the given value in
number variable.
C Format Specifier
The Format specifier is a string used in the formatted
input and output functions. The format string
determines the format of the input and output. The
format string always starts with a '%' character.
Next Class: Introduction to
Programming languages

You might also like