0% found this document useful (0 votes)
6 views20 pages

Cse 1281 - 1

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 20

Course No.

: CSE 1281
Course Title: Computer and Programming Language
Credit: 3.00

Today’s Topic: Introduction to CSE 1281

CSE 1281 Department of Mechanical Engineering 1


Course Content
Computer: Main parts like I/O devices, Memory unit and CPU. Primary and
secondary storage devices, different memory types. Introduction to Number
System, Overview of DOS, Windows, Linux, MAC, UNIX operating systems,
Essential general purpose packages for word processing, spreadsheet analysis etc.

Programming Language: Concept of Algorithms and Flow chart, Assembly level


language and Machine level language, high level language, Compiler, interpreter,
Source and Object programs. Introduction to C/C++ language, program
construction and date types, I/O statements, Expressions, Decision making,
Loops, Function and its Calling procedure, Recursion, Arrays and pointer, structure
abdominal, Object-oriented programming, Application of computer programming
for solving Mechanical Engineering problems.

CSE 1281 Department of Mechanical Engineering 2


Course Outcomes (COs)

CO1: Comprehend the basics of a computing system including hardware,


software, operating system and number system.

CO2: Develop algorithms and flowcharts prior to programming to ensure


accuracy and reliability of the program

CO3: Apply the knowledge of programming language to solve various


technical problems.

CSE 1281 Department of Mechanical Engineering 3


Program Outcomes (POs)
PO1: Engineering Knowledge
PO2: Problem Analysis
PO3: Design of Solution
PO4: Investigation
PO5: Modern Tool Usage
PO6: Engineer & Society
PO7: Environment & Sustainability
PO8: Ethics
PO9: Individual Work and Teamwork
PO10: Communication
PO11: Project Management and Finance
PO12: Life-Long Learning

CSE 1281 Department of Mechanical Engineering 4


Why programming as a Mechanical Engineer?

CSE 1281 Department of Mechanical Engineering 5


Importance of C

o It is a robust language whose built-in functions and operators can be


used to write any complex programs.
o Efficient and Fast (Requires only one second to increment a variable
from 0 to 15000).
o There are only 32 keywords.
o Highly portable.
o Ability to extent itself (Freedom to add our own functions to the
library).

CSE 1281 Department of Mechanical Engineering 6


Observe the Following Simple Program

Input Output

CSE 1281 Department of Mechanical Engineering 7


Analyzing the Program
• The Line 1 indicates the linking of library function
to the program.
• main() is a special function that tells the compiler
where to start.
• Therefore, a program should have only one main()
function.
• The empty pair of paranthesis () after main tells
that the function has no arguments or parameters.
• “{” represents the beginning of the function and “}”
represents the closing.

CSE 1281 Department of Mechanical Engineering 8


Analyzing the Program

o The program consists of three statements.


o The statement starting with /* and ending with
*/ is called the “comment line” and is not
executable statements and is ignored by the
compiler.
o The only executable statement in the program
contains the function printf.
o It prints out everything written in between
quotation marks.

CSE 1281 Department of Mechanical Engineering 9


Analyzing the Program
o It is preferred to use #include<stdio.h> at the beginning.
o It is a library function that contains necessary functions for
programming.
o main function is a part of every C program and C permits various forms
of main statements –
➢ main ()
➢ int main ()
➢ void main ()
➢ main (void)
➢ void main (void)
➢ int main (void)

CSE 1281 Department of Mechanical Engineering 10


Basic Structure of C Program

CSE 1281 Department of Mechanical Engineering 11


Basic Structure of C Program

Documentation Section:
oName of the program
oAuthor name
oOther details

Link Section:
oProviding instructions to link functions
from library

CSE 1281 Department of Mechanical Engineering 12


Basic Structure of C Program

Definition Section:
oDefines all symbolic constants

Global Declaration Section:


oGlobal variables are declared

CSE 1281 Department of Mechanical Engineering 13


Basic Structure of C Program

main() Function Section:


oEach program must have one main()
function section
oIt has two parts i.e., declaration part
and executable part
oDeclaration part or statement
declares all the variables inside the
function
oThere is at least one statement in the
executable part
oEach statement ends with a
semicolon (;)

CSE 1281 Department of Mechanical Engineering 14


Basic Structure of C Program

Subprogram Section:
oUser-defined functions are present
that are called in the main() function.
oThey can appear in any order.

CSE 1281 Department of Mechanical Engineering 15


Sample Program

Input Output

CSE 1281 Department of Mechanical Engineering 16


Executing a Program

Executing a C program involves a number of steps:

1. Creating the program


2. Compiling the program
3. Linking the program with the functions from C library
4. Executing the program

CSE 1281 Department of Mechanical Engineering 17


Process of Compiling and Running A Program

CSE 1281 Department of Mechanical Engineering 18


Software Download Link

CodeBlocks:
https://www.fosshub.com/Code-Blocks.html?dwl=codeblocks-
20.03mingw-setup.exe

Visual Studio Code:


https://code.visualstudio.com/download

CSE 1281 Department of Mechanical Engineering 19


Reference Books

Will be uploaded in the Google Classroom

CSE 1281 Department of Mechanical Engineering 20

You might also like