Define a structure in c++, C/C++ Programming

Define a structure in C++:

Write a program a structure in c++ program.

void main()

{

                struct player

                {

                char name[20];

                int age,height;

                }    ;

       struct player p[3];

 

                int i,j,k;

                clrscr();

                for (i=0;i<=2;i++)

                    {

                      printf("Enter the name of player %d ,age %d,height %d\n",i+1,i+1,i+1);

                      scanf("%s %d %d",p[i].name,&p[i].age,&p[i].height);

                    }

                                for (i=0;i<=2;i++)

                    {

                       printf("%s %d %d\n",p[i].name,p[i].age,p[i].height);

                    }

       getch();

}

Posted Date: 10/19/2012 3:08:17 AM | Location : United States







Related Discussions:- Define a structure in c++, Assignment Help, Ask Question on Define a structure in c++, Get Answer, Expert's Help, Define a structure in c++ Discussions

Write discussion on Define a structure in c++
Your posts are moderated
Related Questions
Example of structure: struct item {                 int element;                 node_ptr next; }; typedef node_ptr stack; stack create(void) {

What are the different types of endless loops? An endless loop can be of two types: i.) A loop that is intentionally designed to go round and round until the condition withi

Is there any difficulty with the following : char*a=NULL; char& p = *a;? A: The result is indeterminate. You must never do this. A reference has to always refer to some object.

THEORY OF A COMPUTER PROGRAMMING

Write a sequence of instructions that transfers data from memory to an external I/O device by using channel 3 of the 8237 DMA controller. Transfer from 20000H-20FFFH.

Is there any difference between List x; and List x ()? Can you please provide me assignment help.

Problem 1. Discuss polymorphism in c++. Explaining Polymorphism 2. Write a program in c++ to read a 3X2 matrix and find smallest number in that matrix. Writin

luminous jewel polishing necklace,c/c++ programming

Environment - C, Linux Duration - December 2006 to Feb 2007 Description - TR-106 specifies a generic data model template applicable for all TR-069 enabled devices. Adde

#include #include using namespace std; class Book { private: string title; int iD; int year_pub; string author; public: string getTitle(); int getId(); int getYear_Pub(); st