12
Submitted to: Miss Farah Nawaz Department of Computer Science Newports Institute of Communications and Economics Submitted by: Zuhaib Ali (NI-S13-BS-040001) Muhammad Shoaib (NI-F13-BS-040012) Course: Programming Techniques 1

Converter - C- Language Program

Embed Size (px)

DESCRIPTION

This is the report of a program made by me and my friend Shoaib Khan, This program is written in C Language. If you want the copy of this program write me...

Citation preview

Page 1: Converter - C- Language Program

Submitted to:Miss Farah NawazDepartment of Computer Science Newports Institute of Communications and Economics

Submitted by:Zuhaib Ali (NI-S13-BS-040001)

Muhammad Shoaib (NI-F13-BS-040012)

Course:Programming Techniques 1 Fall – 2013

Page 2: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Table of Contents

Acknowledgements...............................................................................................................................1

Introduction...........................................................................................................................................1

Conversations........................................................................................................................................1

Programming.........................................................................................................................................2

Header file.........................................................................................................................................2

Switch case........................................................................................................................................2

If- else statement...............................................................................................................................3

Custom function................................................................................................................................3

Temperature..........................................................................................................................................4

Formulas............................................................................................................................................4

Result.................................................................................................................................................5

Example....................................................................................................................................5

Time.......................................................................................................................................................5

Formulas............................................................................................................................................6

Result.................................................................................................................................................6

Example....................................................................................................................................6

Length....................................................................................................................................................6

Formulas............................................................................................................................................7

Result.................................................................................................................................................7

Example....................................................................................................................................7

Flow Chart of Converter........................................................................................................................8

Zuhaib Ali, Muhammad Shoaib Page ii

Page 3: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Acknowledgements

The whole praise is to Almighty Allah, creator of this universe, who made us

the super creature with great knowledge. We, Zuhaib Ali, Muhammad Shoaib,

as a group of student of Newports Institute of Communication and Economics,

pays great thanks to our teacher Miss Farah Nawaz, who has given us the

golden opportunity to do this wonderful project, that helped us in doing a lot

of research and we came to know about so many new things and ideas.

In last but not the least, we would like to thank our parents and friends who

prayed for our success and encouraged us during this research period and

supporting us throughout our lives.

Introduction

During the fall 2013 semester, our teacher told us to create a program in Turbo

C Compiler using C Language. We decide to create a Converter that can

convert Temperature, Time and Length. Because in creating such a program we

can learn many new techniques about how to make program.

After we complete the program, now we really know many things that we

don’t know previous.

Conversations

In our program we have give three physical quantities to be converter from its

one unit to another. These physical quantities are listed below.

Temperature

Time

Length

Zuhaib Ali, Muhammad Shoaib Page 1

Page 4: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Programming

In this section we will describe the program in programming aspect. Like what

is the technique working behind the program? And how the program actually

works?

Header file

In this program we have included only one header file that is Stdio.h.

Stdio.h file is the name of the standard library definition file for all Standard

Input, Output.

Switch case

We used switch case statement to make decisions or choices based on the

value of a conditional expression and specified cases.

Zuhaib Ali, Muhammad Shoaib Page 2

Page 5: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

If- else statement

Now we have used if-else statement the relational operators for making

comparisons, The if-else statement is used to express decisions, If

expression evaluates to true, Statement1 is executed and the

program continues with Next statement.

If expression evaluates to false, Statement2 that follows the else

keyword is executed, and the program continues with Next_statement

Custom function

We have created 11 custom functions in our program.

Temperature

o Celsius to all

o Fahrenheit to all

o Kelvin to all

Time

o Day to all

o Hour to all

o Minute to all

o Second to all

Length

o Centimeter to all

o Foot to all

o Inch to all

Zuhaib Ali, Muhammad Shoaib Page 3

Page 6: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

o Meter to all

Temperature

Temperature is most common physical quantity; it is use to measure how of

hot or cold an object is. It may be measure in any of various units such as

Celsius, Fahrenheit, Kelvin, Rankine, Delisle, Newton, etc. We have given three

frequent used units in our program to converter from one to both others.

These units are listed below

Celsius

Fahrenheit

Kelvin

Formulas

The formulas used for temperature conversations in this program are as given

in below table.

Temperature

From

Celsius Fahrenheit Kelvin

To

Celsius = (Fahrenheit-32)/1.8 Kelvin-273.15

Fahrenheit Celsius*1.8 = (Kelvin*1.8)-459.67

Kelvin Celsius+273.15 (Fahrenheit+459.67)/1.8 =

Zuhaib Ali, Muhammad Shoaib Page 4

Page 7: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Result

After selecting the input unit program the program ask to enter temperature in

selected unit and calculate the result in other units and print it.

Example

Time

Time is another common physical quantity; the indefinite continued progress

of existence and events in the past, present, and future regarded as a

whole.Time is measured in hours and minute’sseconds, days, weeks, years,

decay, etc. We have given four units in our program to converter from one to

other three units. These units are listed below

Days

Hours

Minutes

Seconds

Zuhaib Ali, Muhammad Shoaib Page 5

Page 8: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Formulas

The formulas used for time conversations in this program are as given in below

table.

TimeFrom

Days Hours Minutes Seconds

To

Days = Hours/24 Minutes/60/24

Seconds/60/60/24

Hours Days*24 = Minutes/60 Seconds/60/60

Minutes

Days*24*60 Hours*60 = Seconds/60

Seconds

Days*24*60*60

Hours*60*60

Minutes*60 =

Result

After selecting the input unit program the program ask to enter time in

selected unit and calculate the result in other units and print it.

Example

Length

Length is also another common physical quantity; that is used to measure

distance between two points.It is measured in foot, inch, kilometer, mile,

Zuhaib Ali, Muhammad Shoaib Page 6

Page 9: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

meter, millimeter, yard, etc. We have given four units in our program to

converter from one to both others. These units are listed below

Centimeter

Foot

Inch

Meter

Formulas

The formulas used for Length conversations in this program are as given in

below table.

LengthFrom

Centimeter Foot Inch Meter

To

Centimeter

= Foot*30.48 Inch/0.3937

Meter*100

Foot Centimeter*0.033

= Inch/12 Meter/0.3048

Inch Centimeter*0.398

Foot*12 = Meter/0.0254

Meter Centimeter*100 Foot*0.3048

Inch/39.37 =

Zuhaib Ali, Muhammad Shoaib Page 7

Page 10: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Result

After selecting the input unit program the program ask to enter Length in

selected unit and calculate the result in other units and print it.

Example

Zuhaib Ali, Muhammad Shoaib Page 8

Page 11: Converter - C- Language Program

Newports Institute of Communication and EconomicsProject Report

Flow Chart of Converter

Zuhaib Ali, Muhammad Shoaib Page 9