Dsa Assignment 1
Dsa Assignment 1
Code:
#include <iostream>
int main() {
return 0;
Output:
Question 2
Code:
#include <iostream>
int main() {
int years;
return 0;
Output:
Question 3
Code:
#include <iostream>
int main() {
int originalMatrix[rows][cols];
cout << "Enter element at position (" << i + 1 << ", " << j + 1 << "): ";
int transposeMatrix[cols][rows];
transposeMatrix[j][i] = originalMatrix[i][j];
return 0;
Output:
Question 4
Code:
#include <iostream>
class Employee {
protected:
string name;
string jobTitle;
string dateOfJoining;
public:
void displayInfo() {
};
protected:
string qualification;
public:
Teacher(const string& name, const string& jobTitle, const string& dateOfJoining, const string&
qualification)
void displayInfo() {
Employee::displayInfo();
};
protected:
double monthlySalary;
public:
void displayInfo() {
Teacher::displayInfo();
};
protected:
double payRate;
int hoursWorked;
public:
void displayInfo() {
Teacher::displayInfo();
cout << "Pay Rate: $" << payRate << " per hour" << endl;
cout << "Hours Worked in a Month: " << hoursWorked << " hours" << endl;
};
protected:
int totalExperience;
public:
void displayInfo() {
Employee::displayInfo();
cout << "Total Experience: " << totalExperience << " years" << endl;
};
int main() {
regularTeacher.displayInfo();
visitingTeacher.displayInfo();
manager.displayInfo();
return 0;
Output: