├── Assignment ├── README.md └── Assignment_1 │ ├── Problem1.md │ ├── Problem2.md │ ├── Problem3.md │ └── Submission │ ├── Readme.md │ ├── Ayush_Dhruw_DS_15 │ ├── Addcomplex.cpp │ ├── Addtime.cpp │ └── Calander.cpp │ └── Hitendra_DS_23 │ ├── ComplexAddtion.cpp │ ├── Addtime.cpp │ └── Calander.cpp └── README.md /Assignment/README.md: -------------------------------------------------------------------------------- 1 | # Assignments Submission page. 2 | 3 | -------------------------------------------------------------------------------- /Assignment/Assignment_1/Problem1.md: -------------------------------------------------------------------------------- 1 | # Problem Statement 2 | 3 | ## Write a c++ program to add two complex numbers. 4 | -------------------------------------------------------------------------------- /Assignment/Assignment_1/Problem2.md: -------------------------------------------------------------------------------- 1 | # Problem Statement 2 | 3 | ## Write a program to add hour,minute and second. 4 | -------------------------------------------------------------------------------- /Assignment/Assignment_1/Problem3.md: -------------------------------------------------------------------------------- 1 | # Problem Statement 2 | ## Write a c++ program to print the calendar of the year 2024 3 | -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Readme.md: -------------------------------------------------------------------------------- 1 | ## Create a folder of your name where you will be sunmitting your assignments throughout the semester. 2 | -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Ayush_Dhruw_DS_15/Addcomplex.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class Complex { 4 | private: 5 | double real; 6 | double imaginary; 7 | 8 | public: 9 | Complex(double r = 0.0, double i = 0.0) : real(r), imaginary(i) {} 10 | 11 | Complex operator+(const Complex& other) const { 12 | return Complex(real + other.real, imaginary + other.imaginary); 13 | } 14 | 15 | void display() const { 16 | std::cout << real << " + " << imaginary << "i" << std::endl; 17 | } 18 | }; 19 | 20 | int main() { 21 | Complex num1(2.5, 3.7); 22 | Complex num2(1.8, 4.2); 23 | 24 | Complex sum = num1 + num2; 25 | 26 | std::cout << "Sum: "; 27 | sum.display(); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Hitendra_DS_23/ComplexAddtion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class Complex { 4 | private: 5 | double real; 6 | double imaginary; 7 | 8 | public: 9 | Complex(double r = 0.0, double i = 0.0) : real(r), imaginary(i) {} 10 | 11 | Complex operator+(const Complex& other) const { 12 | return Complex(real + other.real, imaginary + other.imaginary); 13 | } 14 | 15 | void display() const { 16 | std::cout << real << " + " << imaginary << "i" << std::endl; 17 | } 18 | }; 19 | 20 | int main() { 21 | Complex num1(2.5, 3.7); 22 | Complex num2(1.8, 4.2); 23 | 24 | Complex sum = num1 + num2; 25 | 26 | std::cout << "Sum: "; 27 | sum.display(); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Hitendra_DS_23/Addtime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void addTime(int h1, int m1, int s1, int h2, int m2, int s2) { 4 | int totalSeconds = s1 + s2; 5 | int carryMinutes = totalSeconds / 60; 6 | int seconds = totalSeconds % 60; 7 | 8 | int totalMinutes = m1 + m2 + carryMinutes; 9 | int carryHours = totalMinutes / 60; 10 | int minutes = totalMinutes % 60; 11 | 12 | int hours = h1 + h2 + carryHours; 13 | 14 | std::cout << "Sum of times: " << hours << " hours, " << minutes << " minutes, " << seconds << " seconds" << std::endl; 15 | } 16 | 17 | int main() { 18 | int hour1, minute1, second1; 19 | int hour2, minute2, second2; 20 | 21 | std::cout << "Enter first time (hours minutes seconds): "; 22 | std::cin >> hour1 >> minute1 >> second1; 23 | 24 | std::cout << "Enter second time (hours minutes seconds): "; 25 | std::cin >> hour2 >> minute2 >> second2; 26 | 27 | addTime(hour1, minute1, second1, hour2, minute2, second2); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Ayush_Dhruw_DS_15/Addtime.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void addTime(int h1, int m1, int s1, int h2, int m2, int s2) { 4 | int totalSeconds = s1 + s2; 5 | int carryMinutes = totalSeconds / 60; 6 | int seconds = totalSeconds % 60; 7 | 8 | int totalMinutes = m1 + m2 + carryMinutes; 9 | int carryHours = totalMinutes / 60; 10 | int minutes = totalMinutes % 60; 11 | 12 | int hours = h1 + h2 + carryHours; 13 | 14 | std::cout << "Sum of times: " << hours << " hours, " << minutes << " minutes, " << seconds << " seconds" << std::endl; 15 | } 16 | 17 | int main() { 18 | int hour1, minute1, second1; 19 | int hour2, minute2, second2; 20 | 21 | std::cout << "Enter first time (hours minutes seconds): "; 22 | std::cin >> hour1 >> minute1 >> second1; 23 | 24 | std::cout << "Enter second time (hours minutes seconds): "; 25 | std::cin >> hour2 >> minute2 >> second2; 26 | 27 | addTime(hour1, minute1, second1, hour2, minute2, second2); 28 | 29 | return 0; 30 | } -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Hitendra_DS_23/Calander.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | int year, month; 6 | 7 | std::cout << "Enter year: "; 8 | std::cin >> year; 9 | 10 | std::cout << "Enter month (1-12): "; 11 | std::cin >> month; 12 | 13 | int daysInMonth; 14 | if (month == 2) { 15 | if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { 16 | daysInMonth = 29; 17 | } else { 18 | daysInMonth = 28; 19 | } 20 | } else if (month == 4 || month == 6 || month == 9 || month == 11) { 21 | daysInMonth = 30; 22 | } else { 23 | daysInMonth = 31; 24 | } 25 | 26 | int startDay = (year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400; 27 | for (int i = 1; i < month; i++) { 28 | if (i == 2) { 29 | if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { 30 | startDay += 29; 31 | } else { 32 | startDay += 28; 33 | } 34 | } else if (i == 4 || i == 6 || i == 9 || i == 11) { 35 | startDay += 30; 36 | } else { 37 | startDay += 31; 38 | } 39 | } 40 | startDay %= 7; 41 | 42 | std::cout << "---------------------------" << std::endl; 43 | std::cout << " " << std::setw(4) << year << " " << std::endl; 44 | std::cout << "---------------------------" << std::endl; 45 | std::cout << " Sun Mon Tue Wed Thu Fri Sat" << std::endl; 46 | std::cout << "---------------------------" << std::endl; 47 | 48 | for (int i = 0; i < startDay; i++) { 49 | std::cout << " "; 50 | } 51 | 52 | for (int day = 1; day <= daysInMonth; day++) { 53 | std::cout << std::setw(4) << day; 54 | 55 | if ((startDay + day) % 7 == 0) { 56 | std::cout << std::endl; 57 | } 58 | } 59 | 60 | std::cout << std::endl << "---------------------------" << std::endl; 61 | 62 | return 0; 63 | } -------------------------------------------------------------------------------- /Assignment/Assignment_1/Submission/Ayush_Dhruw_DS_15/Calander.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() { 5 | int year, month; 6 | 7 | std::cout << "Enter year: "; 8 | std::cin >> year; 9 | 10 | std::cout << "Enter month (1-12): "; 11 | std::cin >> month; 12 | 13 | int daysInMonth; 14 | if (month == 2) { 15 | if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { 16 | daysInMonth = 29; 17 | } else { 18 | daysInMonth = 28; 19 | } 20 | } else if (month == 4 || month == 6 || month == 9 || month == 11) { 21 | daysInMonth = 30; 22 | } else { 23 | daysInMonth = 31; 24 | } 25 | 26 | int startDay = (year - 1) * 365 + (year - 1) / 4 - (year - 1) / 100 + (year - 1) / 400; 27 | for (int i = 1; i < month; i++) { 28 | if (i == 2) { 29 | if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { 30 | startDay += 29; 31 | } else { 32 | startDay += 28; 33 | } 34 | } else if (i == 4 || i == 6 || i == 9 || i == 11) { 35 | startDay += 30; 36 | } else { 37 | startDay += 31; 38 | } 39 | } 40 | startDay %= 7; 41 | 42 | std::cout << "---------------------------" << std::endl; 43 | std::cout << " " << std::setw(4) << year << " " << std::endl; 44 | std::cout << "---------------------------" << std::endl; 45 | std::cout << " Sun Mon Tue Wed Thu Fri Sat" << std::endl; 46 | std::cout << "---------------------------" << std::endl; 47 | 48 | for (int i = 0; i < startDay; i++) { 49 | std::cout << " "; 50 | } 51 | 52 | for (int day = 1; day <= daysInMonth; day++) { 53 | std::cout << std::setw(4) << day; 54 | 55 | if ((startDay + day) % 7 == 0) { 56 | std::cout << std::endl; 57 | } 58 | } 59 | 60 | std::cout << std::endl << "---------------------------" << std::endl; 61 | 62 | return 0; 63 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Object-Oriented Programming (OOPs) Class Repository 3 | 4 | Welcome to the Object-Oriented Programming (OOPs) class repository! This repository contDSns all the materials, notes, and assignments related to the OOPs course. 5 | 6 | ## Folder Structure 7 | 8 | 1. **Notes**: This folder contDSns all the lecture notes, presentations, and study materials for the OOPs course. 9 | 10 | 2. **Assignments**: This folder contDSns the assignments for the course. 11 | 12 | - **Assignment_x**: Each assignment is organized into its own subfolder, named `Assignment_x`, where `x` is the assignment number. 13 | - **problem_x.md**: This file contDSns the problem statement for the assignment. 14 | - **submissions**: Students will submit their assignments by creating a folder in this directory following the format `roll_no(in_class)_Name`. For example, if a student with roll number `12345` in the class submits an assignment, their folder would be named `12345_Name`. 15 | 16 | ## Assignment Submission Guidelines 17 | 18 | To submit an assignment, follow these steps: 19 | 20 | 1. **Fork the Repository**: Click on the "Fork" button at the top right corner of the repository's page to create a copy of the repository in your GitHub account. 21 | 22 | 2. **Clone Your Fork**: Clone the forked repository to your local machine using the following command in your terminal: 23 | 24 | ``` 25 | git clone https://github.com/your-username/DS-OOPs-2nd-Sem.git 26 | ``` 27 | 28 | 3. **Create a Branch**: Create a new branch for your assignment using the following command: 29 | 30 | ``` 31 | git checkout -b assignment_x_submission 32 | ``` 33 | 34 | Replace `x` with the assignment number. 35 | 36 | 4. **Work on Your Assignment**: Navigate to the appropriate assignment folder (`Assignment_x`) and complete the assignment. 37 | 38 | 5. **Commit Your Changes**: After completing the assignment, commit your changes with a descriptive message: 39 | 40 | ``` 41 | git add . 42 | git commit -m "Add solution for Assignment x" 43 | ``` 44 | 45 | 6. **Push Your Changes**: Push your changes to your forked repository: 46 | 47 | ``` 48 | git push origin assignment_x_submission 49 | ``` 50 | 51 | 7. **Create a Pull Request (PR)**: Go to your forked repository on GitHub and click on the "New pull request" button. Compare and review the changes, then click "Create pull request". 52 | 53 | 8. **Title and Description**: Provide a descriptive title and description for your pull request, mentioning the assignment number and any additional information or notes related to the submission. 54 | 55 | 56 | 57 | 58 | 59 | --------------------------------------------------------------------------------