Skip to content

Commit 1cee2b3

Browse files
committed
UPDATED
1 parent 574f7f5 commit 1cee2b3

7 files changed

+31
-35
lines changed

AreaVolume.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include <iostream>
22
using namespace std;
3-
static int obj;
43

54
class Area
65
{

Employee.cpp

+27-30
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include <iostream>
2-
#include<string.h>
2+
#include <string.h>
33
using namespace std;
44
int obj;
55
class Employee
@@ -11,7 +11,7 @@ class Employee
1111

1212
public:
1313
void accept();
14-
int findEmploy(char*);
14+
int findEmploy(char *);
1515
void display();
1616
Employee()
1717
{
@@ -25,32 +25,29 @@ class Employee
2525

2626
void Employee ::accept()
2727
{
28-
cout << "\nEnter Employee details : \n";
29-
30-
31-
cout << "Name of Emplyee : ";
32-
cin >> name;
33-
cout << "ID : ";
34-
cin >> id;
35-
cout << "Salary : Rs. ";
36-
cin >> salary;
37-
cout << "---------------------------------------------";
28+
cout << "Name of Employee : ";
29+
cin >> name;
30+
cout << "ID : ";
31+
cin >> id;
32+
cout << "Salary : Rs. ";
33+
cin >> salary;
34+
cout << "---------------------------------------------";
3835
}
3936

4037
int Employee ::findEmploy(char *nm)
4138
{
4239
// b=strcmpi(s1,s2); -1 => s2 is before s1, 1 => s1 before s2, 0 => s1 equals s2
43-
if (strcmp(nm,name) == 0)
44-
{
45-
return 1;
46-
}
47-
else
48-
return 0;
40+
if (strcmp(nm, name) == 0)
41+
{
42+
return 1;
43+
}
44+
else
45+
return 0;
4946
}
5047

5148
void Employee ::display()
5249
{
53-
cout << "\nEmplyee Name : " << name;
50+
cout << "\nEmployee Name : " << name;
5451
cout << "\nID : " << id;
5552
cout << "\nSalary : Rs. " << salary << endl;
5653
}
@@ -60,11 +57,11 @@ int main(void)
6057
int n;
6158
cout << "\nEnter number of employees : ";
6259
cin >> n;
63-
Employee e[n]; //creating an object of Employee
60+
Employee e[n]; // creating an object of Employee
6461
for (int i = 0; i < n; i++)
6562
{
63+
cout << "\nEnter details of employee " << i+1 << " : \n";
6664
e[i].accept();
67-
6865
}
6966
cout << "\n\n>>>>>>>>>>>>>>>> LIST OF ALL EMPLOYEES WITH DETAILS <<<<<<<<<<<<<<<< \n";
7067
for (int i = 0; i < n; i++)
@@ -73,22 +70,22 @@ int main(void)
7370
cout << "\n********************************************************************";
7471
}
7572

76-
int flag=0;
73+
int flag = 0;
7774
char nam[100];
7875
cout << "\nEnter employee name you want to search : ";
7976
cin >> nam;
8077

81-
int i=0,j=0;
78+
int i = 0, j = 0;
8279
for (i = 0; i < n; i++)
8380
{
84-
j=e[i].findEmploy(nam);
85-
if(j == 1)
81+
j = e[i].findEmploy(nam);
82+
if (j == 1)
8683
{
87-
flag=1;
84+
flag = 1;
8885
break;
8986
}
9087
}
91-
if (flag==1)
88+
if (flag == 1)
9289
{
9390
cout << "Employee name found!\n";
9491
e[i].display();
@@ -98,11 +95,11 @@ int main(void)
9895
cout << "\nEmployee name Not found." << endl;
9996
}
10097
cout << "\n********************************************************************";
101-
//code to find highest salary :
102-
float max=e[0].salary;
98+
// code to find highest salary :
99+
float max = e[0].salary;
103100
for (int i = 1; i < n; i++)
104101
{
105-
if(max < e[i].salary)
102+
if (max < e[i].salary)
106103
{
107104
max = e[i].salary;
108105
}

Student2

-17.8 KB
Binary file not shown.

file

-17 KB
Binary file not shown.

product.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class product
88
char name[100];
99
long code;
1010
double price;
11-
int stocks, newstk;
11+
int stocks=0, newstk;
1212
int nitems;
1313

1414
public:
@@ -21,7 +21,7 @@ class product
2121
void product::accept()
2222
{
2323
cout << "\nEnter product name: ";
24-
gets(name);
24+
cin >> name;
2525
cout << "Enter product code: ";
2626
cin >> code;
2727
cout << "Enter product price: Rs. ";
@@ -37,7 +37,7 @@ void product::display()
3737

3838
void product::instock()
3939
{
40-
stocks=0;
40+
// stocks=0;
4141
cout << "Enter number of new stocks: ";
4242
cin >> newstk;
4343
stocks += newstk;

product.exe

-30 KB
Binary file not shown.

trackObjects.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @file trackObjects.cpp
3-
* @author Rohit,Rohit (you@domain.com)
3+
* @author Rohit,Rohit (deroyace93@yahoo.com)
44
* @brief Program to keep a track of no. of objects created, destroyed and active in the program.
55
* @version 0.1
66
* @date 2021-12-28

0 commit comments

Comments
 (0)