Posted by: Sourav | November 23, 2012

A simple structure example in C++


#include

using namespace std;

struct part
{
int modelnumber;
int portnumber;
float cost;

};
int main()
{
//cout << “Hello world!” << endl;
part part1,part2;

part1.modelnumber=6244;
part1.portnumber=373;
part1.cost=217.55F;

part2=part1;
cout<<“Model “<<part2.modelnumber<<endl;
cout<<“Port “<<part2.portnumber<<endl;
cout<<“Cost “<<part2.cost<<endl;

return 0;
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: