Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

TEnTYORP 1,8519namenu.quzrcPP 10 59nmenui.qusxPP 7nmenoi.

qPP u,ayantenquepp
Create an Employee class to enter and display informat ion of employee such as Emp1D, Name, Address, Designation
01. Salary
Aand of Last five years and calculate average saiary (create five objects to enter and display dato).
includeciostrea
using namespace stdj
7 class Employeel
9 tring name, id, address, designation;
e float salary[5]i
11
13 float average()
float s
6
for (int i-8; ic5;i-))
sum Sumsalary[i]i
19 return Sun
lab_assgnmentogJ5.cpP ao8539
lab assignment01 q01.cpp lab assignment01 qd2.cpp
22
23 int main()
24
25 cless Eployee e[S]
for (int i-e,ie5;i*)
27
28 cin.clear)
fflush(stdin);
coute"Enter Data 0f Employee no. "eci+1«cendl
cout"Employee's Name: "

getline(cin, e[i].name)
33 cin.clear ()
fflush(stdin) ;
coute«"Employee's ID:"
getline(cin, e[i].id) ;
cin.clear()
fflush(stdin);
coute"Employee's Address: "
getline(cin, e[£].address)
cin.clear()s
42 fflush(stdin)
43 coute"Employee's Designation "
44 getline (cin, e[4].designation )
45 cin.clear ()
46 fflush(stdin);
47 coutce Employee's Salary 0f Last 5 years : "cendl;
for(int j-0,je5ij**)
5 coute«j-1c« Year(s) Back: "
51 cine[i].salary[jls
52
coutecendl«cendl;
couteend1
56
57 for(int i-ejic5j i*)
58
59 cout« "Data Of Employee no. "cci+1c<endl
60 coute"Employee's Name: "<ce[i].nameccendl;
6 coute"Employee"s ID: "ece[i].idecendl
62 cout«e"Employee's Address: "e[i].addressecendl;
coutee"Enployee's Designation : ce[i].designat ione cendl;
64 cout«"Employee's Salary 0f Last 5 years: "<cendl;
65 for (int j-0sje5ij*)
66
67
68
cout«j 1«e" Year(s) Back : "cce[i].salary[j]<cendl;
69 coutee"Average Salary: "c«e[i].average () <cendlecendl;
71
return
73
BFlc PROGRAMlab assignment01 q01.exe
Enter Data Of Employee no.

Employee's Name gaurav


ID 1
Employee's :

Emp loyee 's sangli


Address
chief cle
Employee's Designation :

5
Employee 's Salary 0f Last years
1 Year(s) Back:5eeee
2 Year(s) Back : 40000e
3008
3 Year(s) Back:
Year(s) Back 20000
:10e00
5 Year(s) Back

Enter Data Of Employee no. 2

Employee's Name ram

Emp loyee's ID : 2
Employee's Address sangli
Designation cleark
Emp loyee 's 5
Employee's Salary Of Last years:
1 Year(s) Back : 20000

2 Year(s) Back : 20000


18000
B Year(s) Back :

urce4Year (s) Back: 180ee


1800
5 Year(s) Back

Enter Data Of Employee no.3


Employee's Name : shyam
Employee's ID3
Fmnloyer's A d d r e 5 5 s a n g l i
Employee's Name: raghu
Employee's ID :4

Employee's Address:sangli
cleark
Employee's Designation :

Salary Of Last 5 years


Employee's
Year(s) Back : 2000e
Year(s) Back 20000
Year(s) Back 1800e
4 Year(s) Back: 1800e
5 Year(s) Back: 1800e

Average Salary :1880e

Data Of Employee no. 5


Employee's Name : ramukaka
Employee's ID 5
Employee's Address:sangl1
Employee's Designationsafsafai
Employee's Salary Of Last 5 years
Year(s) Back 5ee8
Year(s) Back : 4008
Year(s) Back: 3eee
Year(s) Back : 2000
ourcet
Year(s) Back 10ee
Average Salary: 3008

thsProcess exited after 279.4 seconds with return value e


Press any key to continue
labassignmento.q01.<Pp a5signmento _guE.cPp

1 2.irite a
program using
class
to accept 5
numbers from user and
dtsplay Larges t,
number omong ffve.
2 econd largest and smallest, second smallest and middle

includecbits/stdc++.h>
uSing namespace stdj

ain()
T
coutee"Enter 5 Numbers: "<<endlj
int arrl5]
tor (int 1-djic5ji)
cin>>arr[1]
1
sort(arr, lest
routse"2nd Smallesst
Nunber :
"e<arr[e]<<endl
Nunber: "<<arr[1]<<endl
coute"Middle Number: "<carr[2]<«endl;
:
cout2nd Largest Number <carr[3]<endlj
coutee"Largest Number: "<carr[4]<«endlj
return
FlcPROGRAMMJab_assignment01.q02.exe
Enter 5 Numbers :

Smallest Number : 1
2nd Smallest Number : 2
iddle Number 3
2nd Largest Number: 4
Largest Number: 5

Processexited after 7.448 seconds with return value e


Press any key to continue.
labassugnmento1_qo1.cppP abassignmentol_go2.cpPP D85gnmentoqu5.CPP
vatues of a, b and c and calculate value of X as
2 3 X atbte
c/da progran to read
here deatb

includeciostream>
Using namespace std;

int main()
the value of
cout<Enter a,b &c: "ccendl;
ana>0>>ci
float

14
(a"b) xce
coutee"x ((float)ci )
return e

17
18
FAcPROGRAMIab_assignment01.q03.ee
Enter the value of a,b & c :

Process exited after 9.929 seconds with return value


Press any key to continue .
lab_assignment01q01.cpPP ab_assignmento1_qo2.cpp lab_assignmento1_q03.cpp lab_as5ign mento1-qo4.cpp
rtte a C* Program to Check given number is Super Prime number or not using function

2 Super prime number is one whose all digits are prime and number is also prime)
3
5
ncudecl0strea
#include ccmath>
using nanespace std;

int isPrime (int n)

int count-e
11
it(n=*1)
return
if(n2
return1 n-3)
for(int i-2jic-sqrt (n) si**)

if(ni-0)
countj
break;

6(coun
return 1
27
28 int issuperPrime (int n)
29
int r
uhile (n>e)
32
35 ren10
4 if(isPrime(r))
35 return e;
36 n-n/1e
37
38 return 1;
39
40
41 int ain)
42 int n
44 cin>n
45 if(isPrime (n) )
46
47 coutee"Not A Super Prime Nunber"ccendl1
48 return e
49
59 if(isSuperPrime(n) )
S1

coute"Super Prime Number"c cendl1


else

coutee Not A Super Prime Number"ccend1


return e
59
aFlcPROGRAMab,assignment01.q04.ex
23
Super Prime Number

Process exited toafter 3.987


continue
seconds with return value e
press any key .
lab assinmet01 q01.cpp lab,assignmento1q02.cpp lab assignmento1.q03.cpp labassignment01.qo4.cpp lab.assygnmentio.g0-cpp
1 1 d irite a Ctr Program t o Find Frequency (count) of voweis and consonants (character vise) in below String
" C P P is easy and great and Python is also great"

4#includeciostream>
5 #include <string
6
using nemespace std
ain()

T
string s "CPP is
easy and great and Python is also great"
int vowel -
cons
for (int i-0jics. size ()si**)
if(s[i]=' ')
contir

*o'||s[i]-- "u')
else if(s[il--'a'||s[4]--'e"||s[i]--"i'||s[i]--'o' ||s[i]--'u'||s[i]J--"A'||s[ij-- °E"||s[i]"1'lls[i]--
lse
consj

vowels : "ccvowel< <endlj


couteNo of : <<cos<cendlj
O ot consonants
Coute
return
FAC PROGRAMlab assignmento1q05.exe
No of vowels: 13
24
No of consonants

with return value


Process exited after 0.0895 seconds
key to continue
Press any

You might also like