Hello Friend!!! Today I am going to learn about Structure in C++.What is Structure and how they Used ? In C++ Not big diff between class and Structure Class have data and function present in it but structure has only data member in it.Data items in a structure is called data member. So Let's See an example of Structure in C++ :
#include
struct Part //Declaring of a Structure//
{
int modelno; //ID model no.//
int partno;
float cost;
};
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main()
{
Part p1; //Define Structure//
p1.modelno=62;
p1.parto=23;
p1.cost=21.55;
///////Display Structure Members////////////
cout<<"model number"<
}
I think this post will help you.I think this post will help you.
Thanks!!!
If any query about this post then put your comment in comment box below...






0 comments:
Post a Comment