2013

Project Report
Converter
(C - Language Program)
A brief report of our project “Converter” written in
C Language.

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
Fall – 2013
Newports Institute of Communication and Economics
Project 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
Newports Institute of Communication and Economics
Project 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
Newports Institute of Communication and Economics
Project 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
Newports Institute of Communication and Economics
Project 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,
expression

true Statement1
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
o Meter to all

Zuhaib Ali, Muhammad Shoaib

Page 3
Newports Institute of Communication and Economics
Project Report

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.
From
Temperature
Fahrenheit

Kelvin

Celsius

=

(Fahrenheit-32)/1.8

Kelvin-273.15

Fahrenheit

Celsius*1.8

=

(Kelvin*1.8)-459.67

Kelvin

To

Celsius

Celsius+273.15

(Fahrenheit+459.67)/1.8

=

Zuhaib Ali, Muhammad Shoaib

Page 4
Newports Institute of Communication and Economics
Project 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
Newports Institute of Communication and Economics
Project Report

Formulas
The formulas used for time conversations in this program are as given in below
table.
From
Time
Hours

Minutes

Seconds

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

=

To

Days

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,
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

Zuhaib Ali, Muhammad Shoaib

Page 6
Newports Institute of Communication and Economics
Project Report



Foot



Inch



Meter

Formulas
The formulas used for Length conversations in this program are as given in
below table.
From
Length
Foot

Inch

Meter

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

=

To

Centimeter

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 7
Newports Institute of Communication and Economics
Project Report

Flow Chart of Converter

Zuhaib Ali, Muhammad Shoaib

Page 8

Converter - C- Language Program

  • 1.
    2013 Project Report Converter (C -Language Program) A brief report of our project “Converter” written in C Language. 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 Fall – 2013
  • 2.
    Newports Institute ofCommunication and Economics Project 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
  • 3.
    Newports Institute ofCommunication and Economics Project 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
  • 4.
    Newports Institute ofCommunication and Economics Project 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
  • 5.
    Newports Institute ofCommunication and Economics Project 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, expression true Statement1 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 o Meter to all Zuhaib Ali, Muhammad Shoaib Page 3
  • 6.
    Newports Institute ofCommunication and Economics Project Report 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. From Temperature Fahrenheit Kelvin Celsius = (Fahrenheit-32)/1.8 Kelvin-273.15 Fahrenheit Celsius*1.8 = (Kelvin*1.8)-459.67 Kelvin To Celsius Celsius+273.15 (Fahrenheit+459.67)/1.8 = Zuhaib Ali, Muhammad Shoaib Page 4
  • 7.
    Newports Institute ofCommunication and Economics Project 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
  • 8.
    Newports Institute ofCommunication and Economics Project Report Formulas The formulas used for time conversations in this program are as given in below table. From Time Hours Minutes Seconds 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 = To Days 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, 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 Zuhaib Ali, Muhammad Shoaib Page 6
  • 9.
    Newports Institute ofCommunication and Economics Project Report  Foot  Inch  Meter Formulas The formulas used for Length conversations in this program are as given in below table. From Length Foot Inch Meter 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 = To Centimeter 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 7
  • 10.
    Newports Institute ofCommunication and Economics Project Report Flow Chart of Converter Zuhaib Ali, Muhammad Shoaib Page 8