0% found this document useful (0 votes)
14 views12 pages

Programming Fundamentals Assignment

The document contains a programming assignment submitted by Amir Bin Arshad for Programming Fundamentals-I, detailing various coding procedures in C++. It includes temperature conversion, expense calculation, simple interest calculation, swapping variables, converting days to years/months/days, finding the youngest among three ages, converting feet and inches to centimeters, and calculating a phone bill based on call usage. Each section provides the code and a brief description of the process involved.

Uploaded by

sq7sxwznnw
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views12 pages

Programming Fundamentals Assignment

The document contains a programming assignment submitted by Amir Bin Arshad for Programming Fundamentals-I, detailing various coding procedures in C++. It includes temperature conversion, expense calculation, simple interest calculation, swapping variables, converting days to years/months/days, finding the youngest among three ages, converting feet and inches to centimeters, and calculating a phone bill based on call usage. Each section provides the code and a brief description of the process involved.

Uploaded by

sq7sxwznnw
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Assignment #1

Submitted to :
Miss Afza Kazmi

Submitted by :
Amir Bin Arshad

Program/Semester:
BSSE-1

Subject:
Programming Fundamentals-I

Department of CS & IT
The University of Lahore, Islamabad Campus
Question 1

Procedure
#include <iostream>

using namespace std;

int main()

float F,C;

cout<<"Enter the temprature in Farenheit \n";

cin>>F;

C=(32*F - 32)*5/9;

cout<<"C:";

return 0;

RESULT 1

Data Flow Diagram 1

Start

Get F

C=(32*F-32)*5/9

End
Question 2

Procedure
#include <iostream>

using namespace std;

int main()

int totalexp,qty,price,discount;

cout<<"Enter quantity \n";

cin>>qty;

cout<<"Enter price \n";

cin>>price;

totalexp=qty*price;

if(totalexp>5000)

discount=totalexp*0.1;

totalexp=totalexp-discount;

cout<<"Total expense is RS:"<<totalexp;

return 0;

Result 2
Question 3

Procedure
#include <iostream>

using namespace std;

int main()

int p,r,t,i;

cout<<"Enter Principle \n";

cin>>p;

cout<<"Enter Rate \n";

cin>>r;

cout<<"Enter Time \n";

cin>>t;

i=(p*r*t)/100;

cout<<"Simple Intrest is:"<<i;

return 0;

Result 3
Data Flow Diagram 3

Start

Get p,r,t

CALCULATE

I=p*r*t

Display =i

End

Question 4

Procedure
#include <iostream>

using namespace std;

int main()

int a=5,b=10,temp;

cout<<"Before swaping \n";


cout<<"a = " << a << " , b = "<<b<<endl;

temp=a;

a=b;

b=temp;

cout<<"\nAfter swaping. \n";

cout<<"a = " << a << ", b = "<<b<<endl;

return 0;

Result 4
Question 5

Procedure
#include <iostream>

using namespace std;

int main()

int days,y,m,d;

cout<<"Please Enter the Total Number of Days"<<endl;

cin>>days;

y=days/365;

days=days%365;

m=days/30;

d=days%30;

cout<<"Years :"<<y<<"\nMonths :"<<m<<"\nDays :"<<d<<endl;

return 0;

Result 5
Data Flow Diagram 5

Start

Get
days,y,m,d

y=days/365;

days=days%365;

m=days/30;

d=days%30;

Display output

End

Question 6

Procedure
#include <iostream>

using namespace std;

int main()

int age1,age2,age3;

cout<<"Please Enter The Age of Sahar"<<endl;

cin>>age1;

cout<<"Please Enter The Age of Suhaib \n";


cin>>age2;

cout<<"Please Enter The Age of Shahzeb"<<endl;

cin>>age3;

if(age1<age2 && age1<age3)

cout<<"Sahar Is The Youngest"<<endl;

if(age1>age2 && age1<age3)

cout<<"Suhaib Is The Youngest \n";

if(age1<age2 && age1>age3)

cout<<"Shahzeb Is The Youngest"<<endl;

return 0;

Result 6

Question7

Procedure
#include <iostream>

using namespace std;

int main()

int feet,inches,f1=12;

float f2=2.54,centimeter,totalinches; 3;
cout<<"Enter Feets:"<<endl;

cin>>feet;

cout<<"Enter inches: \n";

cin>>inches;

totalinches=feet*f1+inches;

centimeter=(totalinches*f2);

cout<<"Centimeters:"<<centimeter<<endl;

return 0;

Result 7

Question 8

Procedure
#include <iostream>

using namespace std;

int main()

int calls;

float bill; 3;

cout<<"Please Enter The Number of Calls"<<endl;


cin>>calls;

if(calls<=100)

bill=200;

else if(calls>100 && calls<=150)

calls=calls-100;

bill=200+(0.60*calls);

else if(calls>150 && calls<=200)

calls=calls-150;

bill=200+(0.60*50)+(0.50*calls);

else

calls=calls-200;

bill=200+(0.60*50)+(0.50*50)+(0.40*calls);

cout<<"Your Bill Is:"<<bill<<endl;

return 0;

}
Result 8

You might also like