forked from natto1784/ooplab
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
d62e8dd839 | |||
a903457fa4 | |||
10350a5670 |
14
file.org
14
file.org
@@ -1,8 +1,16 @@
|
||||
#+title: Object Orientated Programming Lab
|
||||
#+author: Amneesh Singh I6
|
||||
#+LATEX_CLASS_OPTIONS: [a4paper,12pt]
|
||||
#+LATEX_HEADER: \usepackage[margin=0.5in]{geometry}
|
||||
#+OPTIONS: ^:nil
|
||||
#+LATEX_HEADER: \usepackage{fontspec}
|
||||
#+LATEX_HAEDER: \usepackage{graphicx}
|
||||
#+LATEX_HAEDER: \usepackage{longtable}
|
||||
#+LATEX_HEADER: \setmainfont{LiberationSerif}
|
||||
#+LATEX_HEADER: \date{}
|
||||
#+OPTIONS: toc:nil ^:nil
|
||||
|
||||
#+INCLUDE: front.tex
|
||||
#+LATEX: \clearpage
|
||||
|
||||
#+INCLUDE: toc.tex
|
||||
#+LATEX: \clearpage
|
||||
|
||||
|------------------------------------------------------------------------------------------------------------|
|
||||
|
28
front.tex
Normal file
28
front.tex
Normal file
@@ -0,0 +1,28 @@
|
||||
\newgeometry{left=1.5in,right=1.5in}
|
||||
\begin{titlepage}
|
||||
\vspace*{1.2in}
|
||||
\begin{center}
|
||||
{\fontsize{20}{24}\selectfont \textbf{\emp{OBJECT-ORIENTED PROGRAMMING USING C++}}}
|
||||
\end{center}
|
||||
\vspace{0.3in}
|
||||
\hspace{0.3in}
|
||||
\begin{minipage}{2in}
|
||||
Faculty Name:\\
|
||||
NITESH KUMAR\\
|
||||
Assisstant Professor\\
|
||||
I.T. Department
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}{2in}
|
||||
Student: AMNEESH SINGH\\
|
||||
Enrollment: 14114803121\\
|
||||
Semester: III\\
|
||||
Group: I6
|
||||
\end{minipage}
|
||||
|
||||
\begin{center}
|
||||
\includegraphics[width=2in]{mait.png}\\
|
||||
\fontsize{18}{22}\selectfont Maharaja Agrasen Institute of Technology, PSP Area, Sector-22, Rohini, New Delhi 110086
|
||||
\end{center}
|
||||
\end{titlepage}
|
||||
\restoregeometry
|
@@ -76,7 +76,7 @@ int main() {
|
||||
|
||||
#+LATEX: \clearpage
|
||||
|
||||
* Write a program to read the class object of student_info such as name , age ,sex ,height and weight from the keyboard and to store them on a specified file using read() and write() functions. Again the same file is opened for reading and displaying the contents of the file on the screen.
|
||||
* Write a program to read the class object of student_info such as name, age, sex, height and weight from the keyboard and to store them on a specified file using read() and write() functions. Again the same file is opened for reading and displaying the contents of the file on the screen.
|
||||
|
||||
#+ATTR_LATEX: :options frame=single,breaklines=true
|
||||
#+begin_src cpp :tangle 30.cpp :wrap src text
|
||||
|
13
lab9/26.cpp
13
lab9/26.cpp
@@ -1,15 +1,13 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
template <typename T,
|
||||
typename = enable_if<is_arithmetic<T>::value, T>>
|
||||
class Foo
|
||||
{
|
||||
template <class T,
|
||||
class = enable_if<is_arithmetic<T>::value, T>>
|
||||
class Foo {
|
||||
T x, y;
|
||||
|
||||
public:
|
||||
Foo()
|
||||
{
|
||||
Foo() {
|
||||
cout << "x: ";
|
||||
cin >> x;
|
||||
cout << "y: ";
|
||||
@@ -21,8 +19,7 @@ public:
|
||||
T mx() { return (x > y ? x : y); };
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
Foo<float> bar;
|
||||
|
||||
cout << bar.mx() << endl;
|
||||
|
@@ -45,8 +45,8 @@ y: 9.1
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
template <typename T,
|
||||
typename = std::enable_if_t<std::is_arithmetic<T>::value, T>>
|
||||
template <class T,
|
||||
class = enable_if<is_arithmetic<T>::value, T>>
|
||||
class Foo {
|
||||
T x, y;
|
||||
|
||||
|
65
toc.tex
Normal file
65
toc.tex
Normal file
@@ -0,0 +1,65 @@
|
||||
\begin{center}
|
||||
\fontsize{15}{18}\selectfont \textbf{
|
||||
OBJECT-ORIENTED PROGRAMMING USING C++ LAB\\
|
||||
PRACTICAL RECORD
|
||||
}
|
||||
\end{center}
|
||||
|
||||
\begin{table}[h]
|
||||
\begin{tabular}{lcl}
|
||||
Paper Code & : & CIC-257\\
|
||||
Name of the student & : & Amneesh Singh\\
|
||||
University Enrollment number & : & 14114803121\\
|
||||
Branch & : & Information Technology\\
|
||||
Group & : & I6
|
||||
\end{tabular}
|
||||
\end{table}
|
||||
|
||||
\textbf{PRACTICAL DETAILS}
|
||||
|
||||
Experiments according to the lab syllabus prescribed by GGSIPU
|
||||
|
||||
\fontsize{11}{12}\selectfont
|
||||
\renewcommand{\arraystretch}{2.5}
|
||||
\begin{longtable}{|p{0.6cm}|p{8cm}|p{2cm}|p{2cm}|p{2cm}|p{1cm}|} \hline
|
||||
\textbf{Exp. No.} & \textbf{Experiment Name} & \textbf{Performance Date} & \textbf{Date Checked} & \textbf{Remarks} & \textbf{Marks} \\ \hline \hline
|
||||
1 & Write a program to take name, address as a character array, age as int, salary as float and contains inline functions to set the values and display it in class named person & & & & \\ \hline
|
||||
2 & Using the concept of function overloading.Write function for calculating the area of triangle, circle and rectangle & & & & \\ \hline
|
||||
3 & Write a program to find number m to power n. The function power takes a double value for m and int value for n. Use default value for n to make the function to calculate squares when this argument is omitted & & & & \\ \hline
|
||||
4 & Write a program for multiplication of two matrices using OOP & & & & \\ \hline
|
||||
5 & Create a class TIME with members hours, minutes, seconds. Take input, add two time objects passing objects to function and display the result & & & & \\ \hline
|
||||
6 & 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 & & & & \\ \hline
|
||||
7 & Write a program to enter any number and find its factorial using constructor & & & & \\ \hline
|
||||
8 & 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 & & & & \\ \hline
|
||||
9 & Write a program to generate a Fibonacci series using a copy constructor & & & & \\ \hline
|
||||
10 & Write a program to find the biggest of three numbers using friend function & & & & \\ \hline
|
||||
11 & Write a program to demonstrate the use of friend function with Inline assignment & & & & \\ \hline
|
||||
12 & Write a program to find the greatest of two given numbers in two different classes using friend function & & & & \\ \hline
|
||||
13 & Imagine a publishing company that markets both book and audiocassette versions of its works. Create a class publication that stores the title (a string) and price (type float) of a publication. From this class derive two classes: book, which adds a page count (type int), and tape, which adds a playing time in minutes (type float). Each of these three classes should have a getdata() function to get its data from the user at the keyboard, and a putdata() function to display its data. (Simple inheritance and method overriding) & & & & \\ \hline
|
||||
14 & C++ program to read and print employee information using multiple inheritance. The program has following classes: & & & & \\
|
||||
& 1. basicInfo & & & & \\
|
||||
& a. Data: name[char,30],empId[int], gender[char] & & & & \\
|
||||
& b. Functions: getData(), putData(); & & & & \\
|
||||
& 2. deptInfo & & & & \\
|
||||
& a. Data: deptName[char,30], assignWork[char,30], timeToComplete(int) & & & & \\
|
||||
& b. Functions: getData(), putData(); & & & & \\
|
||||
& 3. employeeInfo & & & & \\
|
||||
& a. Data: salary[int], age[int] & & & &\\
|
||||
& b. Functions: getData(), putData(); & & & & \\ \hline
|
||||
14 & Design three classes STUDENT ,EXAM and RESULT. The STUDENT class has data members such as rollno, name. create a class EXAM by inheriting the STUDENT class. The EXAM class adds data members representing the marks scored in six subjects. Derive the RESULT from the EXAM class and has its own data members such as total marks. Write a program to model this relationship & & & & \\ \hline
|
||||
16 & Create class first with data members book no, book name and member function getdata and putdata. Create a class second with data members author name ,publisher and members getdata and showdata. Derive a class third from first and second with data member no of pages and year of publication. Display all these information using an array of objects of third class & & & & \\ \hline
|
||||
17 & Create a base class called SHAPE. Use this class to store two double type values. Derive two specific classes called TRIANGLE and RECTANGLE from the base class. Add to the base class, a member function getdata to initialize base class data members and another member function display to compute and display the area of figures. Make display a virtual function and redefine this function in the derived classes to suit their requirements. Using these three classes design a program that will accept driven of a TRIANGLE or RECTANGLE interactively and display the area & & & & \\ \hline
|
||||
18 & Create a base class basic_info with data members name, roll no, gender and two member functions getdata and display. Derive a class physical\_fit from basic\_info which has data members height and weight and member functions getdata and display. Display all the information using object of derived class & & & & \\ \hline
|
||||
19 & Write a program to overload less than ++ operator & & & & \\ \hline
|
||||
20 & Write a program to overload less than + operator & & & & \\ \hline
|
||||
21 & Write a program to overload less than * operator & & & & \\ \hline
|
||||
22 & Write a program to define the function template for swapping two items of the various data types such as integer ,float,and characters & & & & \\ \hline
|
||||
23 & Write a program to define the function template for calculating the square of given numbers with different data types & & & & \\ \hline
|
||||
24 & Write a program to illustrate how template functions can be overloaded & & & & \\ \hline
|
||||
25 & Write a program to illustrate how to define and declare a class template for reading two data items from the keyboard and to find their sum & & & & \\ \hline
|
||||
26 & Write a program to demonstrate the use of special functions, constructor and destructor in the class template. The program is used to find the biggest of two entered numbers \\ \hline
|
||||
27 & Write a program to read a set of lines from the keyboard and to store it on a specified file & & & & \\ \hline
|
||||
28 & Write a program to read a text file and display its contents on the screen & & & & \\ \hline
|
||||
29 & Write a program to copy the contents of a file into another & & & & \\ \hline
|
||||
30 & Write a program to read the class object of student\_info such as name, age, sex, height and weight from the keyboard and to store them on a specified file using read() and write() functions. Again the same file is opened for reading and displaying the contents of the file on the screen & & & & \\ \hline
|
||||
\end{longtable}
|
Reference in New Issue
Block a user