Вы находитесь на странице: 1из 8

Lab # 3: Introduction to I/O Programming

EC - 102 -- Computer Systems and Programming


Submitted to:
Usman Ayub Sheikh
Submitted by:
MUHAMMAD HASSAAN ASIF
MUHAMMAD SHAHERYAR BAIG
BSME, 07, A
School of Mechanical and Manufacturing Engineering
National University of Sciences and Technology
Date: 29-09-15
Table of Contents
Question Statement
Problem Statement
Algorithm
Flowchart
Code
Conclusion
Question statement
Problem Statement
Algorithm
Flowchart
Code
Conclusion

2
2
2
3
4
5
5
5
6
6
7
8

QUESTION STATEMENT
6. On a certain day the British pound was equivalent to $1.487
U.S., the French franc was $0.172, the German deutschemark
was $0.584, and the Japanese yen was $0.00955.Write a
program that allows the user to enter an amount in dollars, and
then displays this value converted to these four other monetary
units.

PROBLEM STATEMENT
In this task we are supposed to write a program that converts
number of dollars entered by the user into British pound , French
franc , German deutschemark and Japanese yen.
ALGORITHM
STEP 1.
STEP 2.
STEP 3.
STEP 4.
STEP 5.
STEP 6.

Start
Declare Variables Dollars,Pounds,Francs,
Deutschemarks and Yens
Read Value of Dollars
Define Pounds,Francs,Deutschemarks and
Yens in terms of Dollars
Display Amounts in Pounds,Francs,Yens
Duetschemark
Stop

FLOWCHART
START

Declare Variables
Dollars,Pounds,Yen,
Deutschemarks and
Francs

Read
Dollars

Pounds =
Dollars/1.487

Francs =
Dollars/0.172

Deutschemarks =
Dollars / 0.584

Yen =
Dollars/0.00955

Display amount in
pounds,francs,
deutschemarks and
yens

Stop

PROGRAM CODE
#include <iostream>
using namespace std;
int main()
{
float dollars,pounds,francs,deutschemarks,yen;
cout << "Enter Amount in Dollars";
cin >> dollars;
pounds=dollars/1.487;
francs=dollars/0.172;
deutschemarks=dollars/0.584;
yen=dollars/0.00955;
cout<<"Amount in pounds" << pounds << endl
<<"Amount in francs" << francs << endl <<"Amount in
4

deutschemark"<<deutschemarks<<endl<<"Amount in
Yen"<<yen<<endl;
return 0;
}
CONCLUSION
This is a currency convertor program

Question Statement
7. You can convert temperature from degrees Celsius to degrees
Fahrenheit by multiplying
by 9/5 and adding 32. Write a program that allows the user to enter a
floating-point number
representing degrees Celsius, and then displays the corresponding
degrees
Fahrenheit.

PROBLEM STATEMENT
In this Task we have to write a program that converts
Temperature in degree celcius into Temperature in degree
Fahrenheit.

ALGORITHM
STEP 1.
Start
STEP 2.
Declare celcius and fahrenheit
STEP 3.
Read celcius
STEP 4.
Multiply celcius by 9/5 and add 32 to it and
assign the result to fahrenheit
STEP 5.
Display fahrenheit
STEP 6.
Stop
FLOWCHART
Start

Declare celcius
and fahrenheit

Read
celcius
Fahrenheit =
(9/5 * celcius ) + 32

Display
Fahrenheit

Stop

PROGRAM CODE
#include <iostream>
using namespace std;
int main()
{
float celsius,fahrenheit ;
cout << "Enter Celsius temperature: ";
cin >> celsius;
fahrenheit = (9 * celsius/5) + 32;
cout << "Fahrenheit = " << fahrenheit << endl;
return 0;
}

CONCLUSION
7

This program converts centigrade temperature into fahrenheit


temperature.

Вам также может понравиться