0% found this document useful (0 votes)
2 views5 pages

1st Assignment (Quarters)

The document outlines an assignment for a software engineering course, requiring the creation of a structure to store employee data, including name, CNIC, and sales data over five years in four quarters. It includes a C++ program that defines an Employee structure, functions to input sales data, sort it, and display the results for three employees. The program demonstrates basic data handling and sorting techniques in C++.

Uploaded by

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

1st Assignment (Quarters)

The document outlines an assignment for a software engineering course, requiring the creation of a structure to store employee data, including name, CNIC, and sales data over five years in four quarters. It includes a C++ program that defines an Employee structure, functions to input sales data, sort it, and display the results for three employees. The program demonstrates basic data handling and sorting techniques in C++.

Uploaded by

zahraakram51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment Work # 01

Semester # 02

Munazza Ishfaq Allies Shaista


FA24-B1-SE-056
Software Engineering
(Section-2B)

Fatima Jinnah Women University, Rawalpindi


Question 01

Create a structure that stores the name, CNIC and sales data. The sales data is of 5 years in four
quarters. So the size of the sales should be 5 by 4. In main, create the array of employee that is of
size 3 and a function that source the sales rate of each employee according to the each quarter.
Create another function that displays the data of each employee.

Program:
// Class 1 (Quarters Program).cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
#include<string>
using namespace std;

struct Employee{
string name;
int CNIC;
int sales[5][4];
};
void Data(Employee &e){

cout<<"Enter Name For Employee: "<<endl;


cin.ignore();
getline(cin, e.name);
cout<<"Enter CNIC: "<<endl;
cin>>e.CNIC;

}
void Sales(int a[5][4]){
for(int i=0; i<4; i++){
cout<<" _________________________"<<endl;
cout<<"|Enter Sales for Quarter "<<i+1<<"|"<<endl;
cout<<" -------------------------"<<endl<<endl;
for(int j=0; j<5; j++){
cout<<"Sale "<<j+1<<": ";
cin>>a[j][i];
}
cout<<endl;
//Bubble Sorting

for(int j=0; j<5-1; j++){


for(int k=0; k<5-j-1; k++){
if(a[k][i]>a[k+1][i]){
int c = a[k][i];
a[k][i] = a[k+1][i];
a[k+1][i] = c;
}

}
}
}
}

void Display(int a[5][4]){


cout<<"________________________________________________________"<<endl;
for(int i=0; i<4; i++){
cout<<"Sales for Quarter "<<i+1<<": ";
for(int j=0; j<5; j++){

cout<<a[j][i]<<" ";
}
cout<<endl;
}
cout<<"_________________________________________________________"<<endl;
}

int _tmain(int argc, _TCHAR* argv[])


{
Employee emp[3];
for(int i=0; i<3; i++){
cout<<"\t====== Details For Employee: ======"<<endl<<endl;
Data(emp[i]);
Sales(emp[i].sales);
Display(emp[i].sales);
}

system("pause");
return 0;
}
Output:
The End…!!

You might also like