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

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b


Define the C Preprocessor? Preprocessor' is a translation stage that is applied to your source code before the compiler proper gets its hands on it usually the preprocessor per

Temperature Conversions. Problems 28 through30generate temperature-conversion tables. Use the following equations that give relationships between temperatures in degrees Fahrenheit


1. De ne a function chomp :: String -> String that selects a run of repeated characters from the start of a string with the run being as long as possible. For example ch

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

What does ODBC do in context with PHP? PHP supports many databases such as dBase, Microsoft SQL Server, Oracle, etc. however, it also supports databases such as filePro, FrontB

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst. Shortest remaining time rst algori