Page 12 - Data Struct
P. 12

12
                   Algorithm and Data Structure


                   An example code segment using  struct

                   Example 1

                     #include <iostream.h>
                      void main ( )
                      {

                          struct  car
                          {

                               char type [30];
                                float price;
                                char colour [30];

                            }  jazz{“Honda”,700000,”red”};
                      cout<<“ Car Details “<<endl;

                     cout<<“ Car type :  “<< jazz.type<<endl;
                      cout<<“ Car price :  RM“<< jazz.price<<endl;
                      cout<<“ Car colour :  “<< jazz.colour<<endl;

                      }
   7   8   9   10   11   12   13   14