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
Changing Field width The printf() and scanf() functions from the standard library, use width specifier for controlling the width of its output . Similarly, the ostream class al

Program for Swapping the Two Integers                 For example, Swapping the two value                                 int x=4,y=6,t;                                 t

Your program will read two kinds of data from two files: names and predicates. It will read a formal expression from standard input and check whether that expression is syntactical

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

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.   #include float start_poin

Aim: To implement a program to swap two numbers using reference arguments. Code: void swap(int *a, int *b) {             int temp;             temp=*a;

A: This will turn o_ "name mangling" for func so that one can connect to code compiled by a C compiler.

write an algorithm to swap values without using third variable

C Program to FIND THE EVEN WORDS IN THE STRING #include conio.h> #include stdio.h> void main() {           char a[50],temp;           int i=0,k=0,l[25],c=0,r=0;

Program of cascading: class vector{                 private :                 int v[3];                   public:                 friend istream & operator >> (