Structure in C++ Assignment

Structure in C++ is very important topic as this is the bridge between the procedural programming language and Object Oriented Programming Language.

C++ notes on structure is available at this link. Here is the assignment on structure ( C++ )

Q1.	 Define a structure for employee having the following fields
		Name			Char[30]
		Empcode		char[10]
		Father’s name		char[30]
		Salary			float;
Q2.	Define a structure for CAR having the following fields
		Model			char[10]
		CC			int
		Name			Char[10]
		Year of manuf.	Int
Q3.	Define a structure for STUDENT	having the following fields
		Student name			char [20]
		Roll no				int
		Father’s name			char[20]
		Class				int
		Section				char
Q4.	Define a structure for BOOK having the following fields
			First name		char[10]
			Last name		char[10]
			Middle name		char[10]
			Name			char[10]
			Place			char [10]
			Access No			integer
			Title				Char[30]
			Pages				integer
			Publisher			Pub_address
			Author				NAME
Q5.	Find out the error(s) for the following code segment
		     	short    day;
			short  month;
			short  year;
		}birth_date, joiing_date , retire_date;
Q6.	Find out the error(s) for the following code segment

	Struct    First
			int    a;
			float   b;
	struct  second
		       int a;
		       float  b;
         s1.a = 10;  s1.b=20;
      s1  = s2;
Q7	Find out the error(s) in the following program segment
	Struct   time
		{    int hrs, mins;
		time  t1;
Q8. 	Identify and discuss the error(s) in the following code segment
	struct s1  {
			int a;
			float b;
			char c;
		   }  st1,st2,st3;
	int  main( )
			struct s2  {
					int  x;
					float y;
					char   z;
		//  read and initialize structure
			Ss3.z = st1.c;
void   func1(  )
	        ss2.x = st1.a;
	        ss3.y = st2.b;
	        ss1.z = st3.c;
	        ss1 = ss3;
Q9.	Give the  output of the following program segment
	struct point
                 int   x, y; 
	void  display( point  P)
	      cout<=450									A+
=400							A
= 350							B+
= 300							B

please feel free to contact us for any query/ suggestion.

Author: rakesh kumar is my online home, here I share all the information related to education, programming - and everything else that attract me. You can get in touch with me in these social sharing websites
Download File :

Leave a Reply