0% found this document useful (0 votes)
31 views

Lab Report: Prepared By: Saad Ishtiaq Submitting To: Sir Waqar Date: 14/05/2018

The document is a lab report submitted by Saad Ishtiaq to Sir Waqar dated 14/05/2018. It contains 8 tasks involving C++ programs to calculate total price, age, temperature conversion, distance conversion, weight and currency conversion, velocity, volume of a cube, and area of a circle. Each task includes the code listing and brief description of the program.

Uploaded by

Saad Satti
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)
31 views

Lab Report: Prepared By: Saad Ishtiaq Submitting To: Sir Waqar Date: 14/05/2018

The document is a lab report submitted by Saad Ishtiaq to Sir Waqar dated 14/05/2018. It contains 8 tasks involving C++ programs to calculate total price, age, temperature conversion, distance conversion, weight and currency conversion, velocity, volume of a cube, and area of a circle. Each task includes the code listing and brief description of the program.

Uploaded by

Saad Satti
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
You are on page 1/ 23

LAB REPORT

Prepared By:
Saad Ishtiaq
Submitting To:
Sir Waqar
Date: 14/05/2018
LAB MANUAL 3
Task 1
#include<iostream>

#include<conio.h>

using namespace std;

int main ()

int amount, cost, total;

cout<<"enter amount of Product=";

cin>>amount;

cout<<endl;

cout<<"enter price of 1=";

cin>>cost;

cout<<endl;

total = cost*amount;

cout<<"total price="<<total<<"rupees"<<endl;

getch ();

}
TASK 2
#include<iostream>

#include<conio.h>

using namespace std;

int main ()

int yob,current,age;

cout<<"enter year of Birth=";

cin>>yob;

cout<<"currwent year=";

cin>>current;

age=current-yob;

cout<<"your age is="<<age<<"years"<<endl;

getch ();

TASK 3
#include<iostream>
#include<conio.h>

using namespace std;

int main ()

int tempf, tempc;

cout<<"enter temperature in Fahrenheit=";

cin>>tempf;

tempc=(tempf-32)*8*5/9;

cout<<"temperature in celsius="<<tempc<<"degrees"<<endl;

getch ();

TASK 4
#include<iostream>

#include<conio.h>

using namespace std;

int main ()

{
int km,m;

cout<<"enter distance in kilometers=";

cin>>km;

cout<<endl;

m=1000*km;

cout<<"distance in meters is="<<m<<"meters";

getch ();

TASK 5
#include<iostream>

#include<conio.h>

using namespace std ;

int main ()

float pounds, kg, dollar, rs;

cout<<"enter weight in pounds=";

cin>>pounds;

pounds=0.546*kg;
cout<<"weight in kg's is="<<pounds<<"pounds"<<endl;

cout<<"enter amount of dollar=";

cin>>dollar;

rs=114.6*dollar;

cout<<"value of rupees="<<rs<<"rs"<<endl;

getch ();

TASK 6
#include<iostream>

#include<conio.h>

using namespace std ;

int main ()

float distance,time,velocity;

cout<<"enter distacne=";

cin>>distance;

cout<<endl;

cout<<"enter time=";
cin>>time;

cout<<endl;

velocity=distance/time;

cout<<"velocity of car="<<velocity<<"km\h"<<endl;

getch ();

TASK 7
#include<iostream>

#include<conio.h>

using namespace std ;

int main ()

int a,vol;

cout<<"enter side of cube=";

cin>>a;

cout<<endl;

vol=a*a*a;
cout<<"volume="<<vol;

getch ();

TASK 8
#include<iostream>

#include<conio.h>

using namespace std;

int main ()

const float pi=3.14F;

int r;

cout<<"enter radius=";

cin>>r;

float area;

area = pi*r*r;

cout<<"area=";

cout<<area;
getch ();

}
LAB MANUAL 4
TASK 1
#include<iostream>

#include<conio.h>

using namespace std ;

int main ()

int l,w,peri,area;

cout<<"enter length of rectangle=";

cin>>l;

cout<<endl;

cout<<"enter width of rectangle=";

cin>>w;

cout<<endl;

area=l*w;

cout<<"area="<<area<<endl;

peri=l+l+w+w;

cout<<"perimeter="<<peri<<endl;

getch ();

}
Task 2
#include<iostream>

#include<conio.h>

#include<iomanip>

using namespace std ;

int main ()

cout<<"***********"<<endl;

cout<<"*"<<setw(10)<<"*"<<endl;

cout<<"*"<<setw(10)<<"*"<<endl;

cout<<"*"<<setw(10)<<"*"<<endl;

cout<<"*"<<setw(10)<<"*"<<endl;

cout<<"*"<<setw(10)<<"*"<<endl;

cout<<"***********"<<endl;

getch ();

}
TASK 3
#include <iostream>

#include<conio.h>

using namespace std;

int main()

char a;

cout << "Enter a character: ";

cin >> a;

cout << "ASCII Value of " << a << " is " << int(a);

getch ();

}
TASK 4
#include <iostream>

#include<conio.h>

#include<iomanip>

using namespace std;

int main()

int mksitc, mkspf, mkscal, titc, tpf, tcal, total;

cout<<"total marks of ITC=";

cin>>titc;

cout<<endl;

cout<<"total marks of PF=";

cin>>tpf;

cout<<endl;

cout<<"total marks of Calculus=";

cin>>tcal;

cout<<endl;
total= titc+tpf+tcal;

cout<<"total mks="<<total;

cout<<endl;

cout<<"obtained in ITC=";

cin>>mksitc;

cout<<endl;

cout<<"obtained in PF=";

cin>>mkspf;

cout<<endl;

cout<<"obtained in Calculus=";

cin>>mkscal;

cout<<endl;

cout<<"Student Name"<<setw(15)<<"F/Name"<<setw(25)<<"obtained marks"<<setw(15)<<"Total


marks"<<endl;

cout<<"Saad Ishtiaq"<<setw(25)<<"Muhammad Ishtiaq"<<endl;

cout<<setw(45)<<mksitc<<setw(20)<<titc<<endl;

cout<<setw(45)<<mkspf<<setw(20)<<tpf<<endl;

cout<<setw(45)<<mkscal<<setw(20)<<tcal<<endl;

cout<<endl<<endl<<endl;

cout<<setw(50)<<"over all total="<<total;

getch () ;

}
TASK 5
#include <iostream>

#include<conio.h>

using namespace std;

int main()

cout<<"He said:" " I am good" ";"<<endl;

getch ();

}
LAB MANUAL 5
TASK 1
#include<iostream>

#include<conio.h>

#include<iomanip>

using namespace std;

int main ()

const float pi=3.14159;

float r, dia, cir, area;

cout<<"enter radius";

cin>>r;

cout<<endl;

dia= 2*r;

cir= 2*pi*r;

area= pi*r*r;

cout<<"OUTPUT"<<endl;

cout<<endl;
cout<<"Diameter"<<setw(20)<<"2*r"<<setw(20)<<dia<<endl;

cout<<"Circumference"<<setw(20)<<"2*pi*r"<<setw(20)<<cir<<endl;

cout<<"Area"<<setw(20)<<"pi*r*r"<<setw(20)<<area<<endl;

cout<<endl;

getch ();

TASK 2
#include<iostream>

#include<conio.h>

using namespace std;

int main ()

int a,b,c;

a=6;

b=8;

c=a;

a=b;
b=c;

cout<<"a=";

cout<<a<<endl;

cout<<"b=";

cout<<b<<endl;

getch ();

LAB MANUAL 7
Task 1
#include<iostream>

#include<conio.h>

#include<iomanip>

using namespace std;

int main ()

for(int i=1; i<=9; i+=2)


{

for(int j =0; j<i ; j++)

cout<<setw(5)<<"*";

cout<<endl;

getch ();

TASK 6
#include<iostream>

#include<conio.h>

using namespace std;

#include<iomanip>

main()

int i;

cout<<endl<<endl;

int count=1;
cout<<endl<<setw(14);

for( i=1;i<=1;i+=1)

cout<<"*";

cout<<endl<<setw(13);

for( i=1;i<=3;i+=1)

cout<<"*";

cout<<endl<<setw(12);

for( i=1;i<=5;i+=1)

cout<<"*";

cout<<endl<<setw(11);

for( i=1;i<=7;i+=1)

cout<<"*";

cout<<endl<<setw(10);

for( i=1;i<=9;i+=1)

cout<<"*";

cout<<endl;

getch();

}
TASK 3
#include<iostream>

#include<conio.h>

using namespace std;

int main ()

int n,rev,rem;

rev=0;

cout<<"enter number=";

cin>>n;

while(n!=0)

rem = n%10;

rev = rev*10+rem;

n/=10;

cout<<"reveresed number="<<rev<<endl;

getch ();
}

You might also like