Converter - C- Language Program

Post on 25-May-2015

400 views 12 download

Tags:

description

This is the presentation 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...

Transcript of Converter - C- Language Program

CONVERTERC- Language Program

Presented to:

Miss Farah NawazComputer Science DepartmentNewports Institute of Communication and

Economics

Presented by: Muhammad Shoaib

Zuhaib Ali

Coerce : Programming Techniques 1

Fall 2013

CONVERTER

We have created a program “converter”.

The program is written in C Language.

That can converter Temperature, Time and Length.

MAIN MENU OF PROGRAM

PROGRAMMINGConverter (C - Language Program)

HEADER FILES Only one header file is used in our program

SWITCH CASE We have used a “Switch Case” in this

program. And give 4 cases.

Switch Case Case 1 - Temperature

Case 2 - Time

Case 3 - Length

Case 4 - Exit

IF FUNCTION In first 3 case we

used “If function”.

Temperature If CelsiusElse if FahrenheitElse if Kelvin

Time If DayElse if HourElse if MinuteElse if Second

Length If CentimeterElse if FootElse if InchElse if Meter

CUSTOM FUNCTION We have created 11 custom functions in our program.

Temperature Celsius to all Fahrenheit to all Kelvin to all

Time Day to all Hour to all Minute to all Second to all

Length Centimeter to all Foot to all Inch to all Meter to all

EXAMPLE OF CUSTOM FUNCTIONCelsiusToAll()

{

float Celsius,Fahrenheit,Kelvin;

clrscr();

printf("Enter Temperature in Celsius: ");

scanf("%f",&Celsius);

Fahrenheit=(1.8*Celsius)+32;

Kelvin=(Celsius+273.15);

printf("\nTemperature in Fahrenheit : %.3f", Fahrenheit);

printf("\nTemperature in Kelvin : %.3f\n", Kelvin);

system("pause");

return 0;

}

FLOW CHART OF PROGRAM

TEMPERATURE

UNITS In “Temperature Conversation” we have

given 3 units. Celsius Fahrenheit Kelvin

FORMULAS The formulas used for temperature

conversations in this program are:

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=

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

UNITS In “Time Conversation” we have given 4

units. Days Hours Minutes Seconds

FORMULAS The formulas used for time conversations in

this program are

Time

From

Days Hours Minutes Seconds

To

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

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

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

SecondsDays*24*60*6

0Hours*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

UNITS In “Length Conversation” we have given 4

units. Centimeter Foot Inch Meter

FORMULAS The formulas used for Length conversations

in this program are:

Length

From

Centimeter Foot Inch Meter

To

Centimeter

= Foot*30.48 Inch/0.3937 Meter*100

FootCentimeter*0.03

3= Inch/12 Meter/0.3048

InchCentimeter*0.39

8Foot*12 = Meter/0.0254

Meter Centimeter*100 Foot*0.3048 Inch/39.37 =

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:

PEN

FLIX

THANK YOU