Coders Packet

C++ program of type conversion from user defined to basic

By Pankhuri

Type conversion takes place from user defined to basic using kg and grams example where it converts the input in the required output.

Type conversion takes place either from basic to basic or in user-defined types. User-defined has 3 types i.e. basic to user-defined, user-defined to basic, and user-defined to user-defined. In this program, we've shown user-defined to basic conversion.

In this, the user gives value in kg and grams which are later converted to weight in grams completely and weight in kg completely. int is used for the grams and float is used for the kg. In this void in() takes the input and void show() shows the output. The main object is created for the class and used to access the function. So, we get the desired output after the conversion.

Download Complete Code

Comments

No comments yet