know yourselves. information, computer, 7 wonders, various.

Sunday, November 12, 2017

C++ programming language part: 43 User defined data type


User defined data type

The fundamental data types are not only data types in C++. You can create your own data types. These data types are called the user define data type. There are two ways by which a user-defined data type is created. the first is by using the keyword called stuct and the second is by using the keyword called class. Furthermore, some element of a structure/class may be function, including operators.

Structure

Data types defined using the keyword struck are called as structures. A structure  is a collection of variables that are referanced by a single name. The variables can be os sifferent type. They provide a convinent means of keeping related information together.  Individuals structure elements can be referrened by conbining the .(dot) operater andthe -> operator is used when a structure element has to be accessed through a pointer.

Program 34
            //structure.demo
            #include
            #include

             struct student
             {
              int id;
              char name[10];
              char address[20];
             };                // either use terminator or would flag an error
        

             void main()
            {
             student st1,*st2,st3;
             cout<<" Type students id,name,address "<
             cin>>st1.id;
             cin>>st1.name;
             cin>>st1.address;
             cin>>st2->id;
             cin>>st2->name;
             cin>>st2->address;
             cin>>st3->id;
             cin>>st3->name;
             cin>>st3->address;

             cout<<" The datas are follows "<
             cout<
             cout<
             cout<
             cout<id<<" ";     //&st2->id
             cout<name<<" ";      //&st2->name
             cout<<&st2->address<<" ";    //&st2->address
             cout<
             cout<
             cout<


             }


Part- 86 assign the content of twostring



জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯