diff --git a/.gitignore b/.gitignore index 1111665..d9541d6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ \#* _minted-file/ .\# -*html \ No newline at end of file +*html +lab*/*pdf \ No newline at end of file diff --git a/file.org b/file.org index 1dc7158..8d9f67f 100644 --- a/file.org +++ b/file.org @@ -1,6 +1,7 @@ #+title: Object Orientated Programming Lab #+author: Amneesh Singh I6 #+LATEX_HEADER: \usepackage[margin=0.5in]{geometry} +#+OPTIONS: ^:nil #+LATEX: \clearpage diff --git a/file.pdf b/file.pdf index 0570c5d..8889035 100644 Binary files a/file.pdf and b/file.pdf differ diff --git a/lab2/6.cpp b/lab2/6.cpp index 96fac03..8e23638 100644 --- a/lab2/6.cpp +++ b/lab2/6.cpp @@ -35,9 +35,6 @@ void Student::input() { cout << "Gender (m/f): "; cin >> this->gender; - if (this->gender != 'm' || this->gender != 'f') - exit(1); - cout << "Enter Marks for" << endl; for (i = 0; i < NSUBS; i++) { @@ -64,6 +61,8 @@ int main() { for (i = 0; i < NSTUDENTS; i++) a[i].input(); + cout << "\nStudents with percentage greater than 70:\n"; + for (i = 0; i < NSTUDENTS; i++) if (a[i].getPercentage() > 70) cout << a[i].getName() << endl; diff --git a/lab2/file.org b/lab2/file.org index 43d305f..9b3a713 100644 --- a/lab2/file.org +++ b/lab2/file.org @@ -100,11 +100,6 @@ int main() { } #+end_src -#+RESULTS: -#+begin_src text --8 -3689 4 28892 -6 1227 -4 -9718 -#+end_src #+LATEX: \clearpage * Create a class TIME with members hours, minutes, seconds. Take input, add two time objects passing objects to function and display the result. [Hint: use class object as parameter of function add()] @@ -169,17 +164,12 @@ int main() { } #+end_src -#+RESULTS: -#+begin_src text -Hours: 68 -Minutes: 32 -Seconds: 0 -#+end_src #+LATEX: \clearpage * Create a class Student which has data members as name, branch, roll no, age , gender, marks in five subjects. Display the name of the student and his percentage who has more than 70%.Use array of objects size 5.[Hint: also declare percentage variable and calculate it and then compare all the object of student class to find name of student with percentage > 70] -#+begin_src cpp :tangle 6.cpp :results output :exports both :wrap src text +#+ATTR_LATEX: :options frame=single,breaklines=true +#+begin_src cpp :tangle 6.cpp :results output :wrap src text #include using namespace std; @@ -216,9 +206,6 @@ void Student::input() { cin >> this->age; cout << "Gender (m/f): "; cin >> this->gender; - - if (this->gender != 'm' || this->gender != 'f') - exit(1); cout << "Enter Marks for" << endl; @@ -246,6 +233,8 @@ int main() { for (i = 0; i < NSTUDENTS; i++) a[i].input(); + cout << "\nStudents with percentage greater than 70:\n"; + for (i = 0; i < NSTUDENTS; i++) if (a[i].getPercentage() > 70) cout << a[i].getName() << endl; @@ -253,3 +242,56 @@ int main() { return 0; } #+end_src + +#+begin_src text +Name: Amaang +Branch: InformationTechnology +Enter Enrollment number: 413 +Age: 14 +Gender (m/f): m +Enter Marks for +Subject 1: 99 +Subject 2: 93 +Subject 3: 9 +Subject 4: 91 +Subject 5: 3 +Name: Allu +Branch: Physics +Enter Enrollment number: 444 +Age: 19 +Gender (m/f): f +Enter Marks for +Subject 1: 100 +Subject 2: 0 +Subject 3: 100 +Subject 4: 0 +Subject 5: 100 +Name: Asli +Branch: Law +Enter Enrollment number: 33 +Age: 99 +Gender (m/f): m +Enter Marks for +Subject 1: 1 +Subject 2: 1 +Subject 3: 1 +Subject 4: 1 +Subject 5: 2 +Name: how +Branch: Music +Enter Enrollment number: 9999 +Age: 9 +Gender (m/f): m +Enter Marks for +Subject 1: 12 +Subject 2: 22 +Subject 3: 32 +Subject 4: 42 +Subject 5: 52 +Name: sabji +Branch: CivilEngineering +Enter Enrollment number: 91 + +Students with percentage greater than 70: +sabji +#+end_src diff --git a/lab3/file.org b/lab3/file.org index bfaa0ee..096841c 100644 --- a/lab3/file.org +++ b/lab3/file.org @@ -28,10 +28,6 @@ int main() { } #+end_src -#+RESULTS: -#+begin_src text -Factorial of 5 is 120 -#+end_src #+LATEX: \clearpage * Write a program to perform addition of two complex numbers using constructor overloading. The first constructor which takes no argument is used to create objects which are not initialized, second which takes one argument is used to initialize real and imag parts to equal values and third which takes two arguments is used to initialize real and imag to two different values. @@ -85,14 +81,10 @@ int main() { } #+end_src -#+RESULTS: -#+begin_src text -38-2120i -#+end_src #+LATEX: \clearpage +#+ATTR_LATEX: :options frame=single,breaklines=true * Write a program to generate a Fibonacci series using a copy constructor. - #+begin_src cpp :tangle 9.cpp :results output :exports both :wrap src text #include using namespace std; diff --git a/lab4/file.org b/lab4/file.org index 5492c3b..27e7b2c 100644 --- a/lab4/file.org +++ b/lab4/file.org @@ -29,15 +29,12 @@ int main() { } #+end_src -#+RESULTS: -#+begin_src text -444 -#+end_src #+LATEX: \clearpage * Write a program to demonstrate the use of friend function with Inline assignment. All friend functions are inline functions. +#+ATTR_LATEX: :options frame=single,breaklines=true * Write a program to find the greatest of two given numbers in two different classes using friend function. #+begin_src cpp :tangle 12.cpp :results output :exports both :wrap src text #include @@ -74,8 +71,3 @@ int main() { cout << bigger(a, b); } #+end_src - -#+RESULTS: -#+begin_src text -55 -#+end_src