User-defined data type, C/C++ Programming

Assignment Help:

Explain User-Defined Data Types?

C has Union and Structure as user-defined data types.  C++ has class which looks like

structure with additional feature to it.  A class can have functions and structure declared to it. This is the foundation for the Object-Oriented programming.

Enumerated data type is also a derived data type.   It is declared like in C with certain added features.  In C we can define a typedef.

typedef int mark;

mark phy,chem,mat;

enum day = { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };

 

In C++ the variable day can be used as typedef.

day daysofweek; is a valid statement in C++.  This mean a same enumerated data type is declared from the original. It is similar to declaring another variable of same type.   The default value for an enumerated data type starts with zero.  It can be changed by assigning the value.

enum dept {CSE=104,EEE=105,ECE-106};

enum dept {CSE=104,EEE,ECE-106}; EEE will be 105

enum dept {CSE,EEE=105,ECE-106}; CSE will be 0 enum dept {CSE=101,EEE,ECE-106}; EEE will be 102 enum onoff{on, off};

 

Enumeration is used as symbolic constant in switch. enum dept {CSE=104,EEE=105,ECE-106}; int main ( )

{int depts;

cin >>depts;

if depts == CSE;

cout <<”Computer Science and Engineering”;

}


Related Discussions:- User-defined data type

Two dimension array- c program, 2-D Array- C program: Define a two dim...

2-D Array- C program: Define a two dimension array using c. void convert ( int a[10][10] , int[] , int , int); void main()   {   clrscr();   int a[10][10], b[10

string to palindrome, A palindrome is a string that reads the same from b...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Assigment, Hi is there any chance to get assignment for fresher tutor

Hi is there any chance to get assignment for fresher tutor

Algorithms, algorithm to find out all the factors of given positive integer...

algorithm to find out all the factors of given positive integers

Area under curve , c-program to find the area under the curve y=f(x) betwe...

c-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_point, /

Constructor , What is constructor or ctor? need help

What is constructor or ctor? need help

I need online game dvelopment, Project Description: Online game developm...

Project Description: Online game development Online Live Baccarat Game is needed - client program. - server program(IOCP or ect..). - web program(ASP or PHP or etc..

Reverse a string - c ++ program, Reverse a string - C ++ program: Writ...

Reverse a string - C ++ program: Write a program in c to reverse a string. int main() {     Stack theStack;     String reverse("reverse");       cout

Answer, Write a program to find the area under the curve y = f(x) between x...

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.

Bulk listing posting for a site like ebay, Project Description: I posted...

Project Description: I posted listings on a site that is like eBay but for video games. I post the similar listing many times daily, but need something that will let me post

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd