C M M Lab Manual
C M M Lab Manual
Mandal’s
Shri Shivaji Institute of Engineering & Management Studies,
Vasmat Road, Parbhani – 431 401 (M.S.)
DEPARTMENT
OF
COMPUTER SCIENCE AND ENGINEERING
Vision:
“Our vision is to become a beacon of hope and empowerment in the backward region,
transforming lives through technical education, innovation, and sustainable
development.”
Mission:
We are dedicated to promoting intellectual, ethical, and cultural values among our students,
while equipping them with the technical and professional skills needed to thrive in today’s
competitive job market, thereby contributing to economic development.
P01:-
The graduates will possess the knowledge of various discrete mathematical systems.
PO2:-
The graduates will have an ability to apply mathematical formalism of Finite Automata and Probability.
in modeling and analysis of systems.
PO3:-
The graduates will have knowledge of core programming paradigms such as database orientation, object
orientation, and agent orientation and concepts essential to implement software based system.
PO4:-
The graduates will have an ability to analyze problem, specify algorithmic solutions to them and to
evaluate alternative solutions.
P05:-
The graduate will have broad understanding of the impact of a computer based solutions in economic,
environmental and social context and will demonstrate use of analytical tools in gathering requirements.
and distilling relevant information to provide computer based solutions.
PO6:-
The graduates will demonstrate the ability to build human centric interfaces to computers.
PO7:-
topics PO8:-
PO9:-
Engineering ideas. The skills set include verbal, written and listening skills. The graduates will
understand ethical issues in providing computer based solutions also they will have an ability and.
attitude to address the ethical issues.
PO10:-
The graduates will understand the role of system software such as operating systems, database.
management systems, compilers, middle-ware and internet protocols in realizing distributed information
environment.
1. LAB OBJECTIVE
2. LAB OUTCOME
Upon successful completion of this Lab the student will be able to:
Reference Books :
1. The C++ Programming Language, 3rd Edition, B. Strattera, Pearson Education.
2. OOP in C++, 3rd Edition, T. Gaddis, J. Walters and G. Muganda, Wiley Dream Tech Press.
int main() {
math obj ;
obj.get();
obj.sum();
obj.sub();
obj.multi();
obj.div();
obj.mod();
return 0;
}
Output:-
Enter two numbers 5 7
sum of two numbers is12
sub of two numbers is-2
multi of two number is35
div of two numbers is0
mod of two numbers is5
#include <iostream>
#include<cstring>
#include <string>
using namespace std;
int main(){
string myadd="Learn coding";
cout<<"Original address is:"<<myadd<<endl;
myadd.push_back('A');
cout<<"modified address is:"<<myadd<<endl;
myadd.pop_back();
cout<<"modified address is:"<<myadd;
return 0;
}
Output:-
Original address is:Learn coding
modified address is:Learn
codingA modified address
is:Learn coding
2] string
#include <iostream>
#include<cstring>
#include <string>
using namespace std;
int main(){
char str[]="Vaishnavi";
string strl="ABC";
int l=strlen(str);
cout<<l<<endl;
string reverse(strl.rbegin(),strl.rend());
cout<<reverse<<endl;
char str2[10];
char str3[]=" Udawant";
char str4[]="Vaishu";
strcat(str,str3);
cout<<str<<endl;
int value=strcmp(str,str4);
if (value==0)
{
3] string
#include <iostream>
#include<string>
using namespace std;
int main() {
char myname[20];
cout<<"Enter your name:-";
cin>>myname ;
cout<<"My name is:-"<<myname<<endl;
string myaddress;
cout<<"Enter your address:-";
cin>>myaddress;
cout<<"full address is:"<<myaddress;
return 0;
}
Output:-
Enter your name:-vgudawant
My name is:-vgudawant
Enter your address:-khanapurNagarPbn
full address is:khanapurNagarPbn
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double x = 2.3;
cout << "Sine value of x=2.3 : " << sin(x) << endl;
cout << "Cosine value of x=2.3 : " << cos(x) << endl;
cout << "Tangent value of x=2.3 : " << tan(x) <<
endl;
double y = 0.25;
cout << "Square root value of y=0.25 : " << sqrt(y)
<< endl;
int z = -10;
cout << "Absolute value of z=-10 : " << abs(z) << endl;
cout << "Power value: x^y = (2.3^0.25) : " << pow(x, y)
<< endl;
x = 3.0;
y = 4.0;
cout << "Hypotenuse having other two sides as x=3.0 and"
<< " y=4.0 : " << hypot(x, y) << endl;
x = 4.56;
cout << "Floor value of x=4.56 is : " << floor(x)
<< endl;
x = -4.57;
cout << "Absolute value of x=-4.57 is : " << fabs(x)
<< endl;
x = 1.0;
cout << "Arc Cosine value of x=1.0 : " << acos(x)
<< endl;
y = 12.3;
cout << "Ceiling value of y=12.3 : " << ceil(y) << endl;
x = 57.3; // in radians
cout << "Hyperbolic Cosine of x=57.3 : " << cosh(x)
<< endl;
cout << "Hyperbolic tangent of x=57.3 : " << tanh(x)
<< endl;
y = 100.0;
// Natural base with 'e'
cout << "Log value of y=100.0 is : " << log(y) << endl;
return 0;
}
Output:-
Sine value of x=2.3 : 0.745705
Cosine value of x=2.3 : -
0.666276 Tangent value of x=2.3
: -1.11921 Square root value of
y=0.25 : 0.5 Absolute value of
z=-10 : 10
Power value: x^y = (2.3^0.25) : 1.23149
Hypotenuse having other two sides as x=3.0 and y=4.0 : 5
Floor value of x=4.56 is : 4
Absolute value of x=-4.57 is : 4.57
Arc Cosine value of x=1.0 : 0
Arc Sine value of x=1.0 : 1.5708
Arc Tangent value of x=1.0 :
0.785398 Ceiling value of y=12.3 : 13
Hyperbolic Cosine of x=57.3 :
3.83746e+24 Hyperbolic tangent of x=57.3
:1
Log value of y=100.0 is : 4.60517
#include <iostream>
using namespace
std; class student
{
public:
void display()
{
cout<<"This is student call"<<endl;
}
};
class Teacher : public student
{
public:
void show()
{
cout<<"This is teacher call";
}
};
int main() {
Teacher Tech;
Tech.display();
Tech.show();
return 0;
}
Output:-
This is student
call This is
teacher call
2] Hierarchical Inheritance
#include<iostream>
3] Hybrid Inheritance
#include<iostream>
using namespace std;
4] Multiple Inheritance
#include <iostream>
using namespace
std; class A
{
public:
int a;
void get_a()
{
cout<<"Enter value of a:";
cin>>a;
}
void show_a()
{
5] Multilevel Inheritance
6] Private Inheritance
#include <iostream>
using namespace
std; class B{
int a;
public:
int b;
void get_ab(){
cout << "Enter a & b:
"; cin >> a >> b;
}
int get_a() {
return a;
}
void show_a() {
cout << "Value of a is " << a << endl;
}
C++ Programming Lab Manual / II-III SEM / 2024-2025 Page 20
};
class D : private B {
int c;
public:
void mul() {
get_ab();
c = b * get_a();
}
void display() {
show_a();
cout << "b = " << b << "\nc = " << c << endl; }};
int main() {
D d;
d.mul();
d.display();
return 0;}
Output:-
Enter a & b: 4
6 Value of a is
4b=6
c = 24
7] Public Inheritance
#include <iostream>
using namespace
std; class B{
int a;
public:
int b;
void getab(){
cout << "Enter a and b:
"; cin >> a >> b;
}
int geta()
{
return a;
}
void showa()
{
cout << "Value of a is: " << a << endl;
}
int main()
{
shape *ptr;
shape obj1;
Rectangle obj2;
square obj3;
ptr=&obj2;
ptr->calculate_area();
ptr=&obj3;
ptr->calculate_area();
ptr=&obj1;
ptr->calculate_area();
return 0;
}
Output:-
Enter l and b:6 5