Professional Documents
Culture Documents
LAB-2
LAB-2
ALGORITHM:
1)START
2)Create a class Television with model number,brand, and price as
data members.
3)Create OR Declare a constructor in class which initializes objects of
class.
4)Include a member function showTelevision() and print the member
values.
5)In main function initialize values of data members and print output
using showTelevision()
6)STOP
PROGRAM:
#include <iostream>
}
void showTelevision();
};
void Television::showTelevision()
{
cout<<"Model number:"<<""<<mdno<<endl;
cout<<"Brand:"<<""<<brand<<endl;
cout<<"price:"<<""<<price<<endl;
}
int main()
{
Television obj("4A324WB2","plasma",50000);
obj.showTelevision();
return 0;
}
OUTPUT:
Model number:4A324WB2
Brand:plasma
price:50000
RESULT:
Class Television is created and constructor and a member function is
created successfully to print the values of data members.