C++ oop
Abdulai Y Mansaray
23/TEC/CS/136.
Q1. About Masjid
#include <iostream>
#include <string>
using namespace std;
class Masjid {
private:
string name;
string location;
int capacity;
public:
void setDetails(string n, string loc, int cap) {
name = n;
location = loc;
capacity = cap;
void displayInfo() {
cout << "\n=== Masjid Information ===" << endl;
cout << "Name: " << name << endl;
cout << "Location: " << location << endl;
cout << "Capacity: " << capacity << " people" << endl;
};
int main(
cout << "=== Masjid Information System ===" << endl;
cout << "Enter Masjid Name: ";
cin >> name;
cout << "Enter Location: ";
cin >> location;
cout << "Enter Capacity: ";
cin >> capacity;
myMasjid.setDetails(name, location, capacity);
myMasjid.displayInfo();
return 0;
Q2. BarbingShop Management System
#include <iostream>
#include <string>
using namespace std;
class BarbingShop {
private:
string shopName;
string owner;
string location;
public:
void setDetails(string name, string ownerName, string shopLocation) {
shopName = name;
owner = ownerName;
location = shopLocation;
void displayDetails() {
cout << "\n--- Barbing Shop Details ---" << endl;
cout << "Shop Name: " << shopName << endl;
cout << "Owner: " << owner << endl;
cout << "Location: " << location << endl;
};
int main() {
BarbingShop myShop;
string name, owner, location;
cout << "Welcome to Barbing Shop Management System!" << endl;
cout << "\nEnter Shop Name: ";
Cin >> name;
cout << "Enter Owner's Name: ";
Cin >> owner;
cout << "Enter Shop Location: ";
Cin >> location;
myShop.setDetails(name, owner, location);
myShop.displayDetails();
return 0;