fix minor latex issues

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2022-12-26 16:30:38 +05:30
parent ad185c994e
commit 21afaa311b
7 changed files with 64 additions and 37 deletions

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@
\#*
_minted-file/
.\#
*html
*html
lab*/*pdf

View File

@@ -1,6 +1,7 @@
#+title: Object Orientated Programming Lab
#+author: Amneesh Singh I6
#+LATEX_HEADER: \usepackage[margin=0.5in]{geometry}
#+OPTIONS: ^:nil
#+LATEX: \clearpage

BIN
file.pdf

Binary file not shown.

View File

@@ -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;

View File

@@ -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 <iostream>
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

View File

@@ -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 <iostream>
using namespace std;

View File

@@ -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 <algorithm>
@@ -74,8 +71,3 @@ int main() {
cout << bigger(a, b);
}
#+end_src
#+RESULTS:
#+begin_src text
55
#+end_src