Skip to main content

Posts

Showing posts from November, 2016

CLASS and OBJECTS

CLASS and OBJECTS 1.Give the output of the following program ( Assuming that all required header files are  included in the program )     :                class TEMP { static int a; float b; public: TEMP( ) { b=10; } void INTEMP( ) { a++; b=a+10; } void OUTTEMP( ) { cout<<a*i<<"$"<<b-3<<endl; } }; int TEMP::a=2; void main() { TEMP ob[5]; for(int x=1;x<5;x++) ob[x].INTEMP( ); for(x=1;x<5;x++) ob[x].OUTTEMP( );}  2.  Define a class Travel in C++ with the description given below: Private Members: T_Code of type string No_of_Adults of type integer No_of_Children of type integer Distance of type integer TotalFare of type float Public Members: A constructor to assign initial values as follows : T_Code with the word “NULL” No_of_Adults as 0 No_of_Children as 0 Distance as 0 TotalFare as 0 A func...