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

Prime no., program to find if a no . is prime or not

program to find if a no . is prime or not

Decode the code, smugglers transfer the messages from one to another by usi...

smugglers transfer the messages from one to another by using the mobile

Explain formatted input output with file pointer, Explain Formatted Input O...

Explain Formatted Input Output with File Pointer? Likewise there are equivalents to the functions scanf and printf which write or read data to files. These are called fscanf a

Linking source code in vc++ 6.0, i have a project in BDD(Binary Decision Di...

i have a project in BDD(Binary Decision Diagram).. where i have to use BDD library...i m using cudd package which uses BDD technique...i download cudd package..try to run in vc++ 6

Arrays within a class, A r r a y s w i t h i n a c l a s s:...

A r r a y s w i t h i n a c l a s s: I t i s j u s t d ecl a r i n g o r c on s t ru c ti n g a d e r i v e d t

Pointers, Pointers are just numbers, representing addresses in memory. You ...

Pointers are just numbers, representing addresses in memory. You can add to and subtract from pointers, for instance. It is pretty easy to make mistakes with pointer math, however,

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..

Design a game in c, Design a game in c: const DODGERS = 0; const GI...

Design a game in c: const DODGERS = 0; const GIANTS = 1;   void main(void) {    int scoreboard [2][9];    // An array two rows by nine columns    int team, i

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

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 betw .

Padovan string ., #questio#A Padovan string P(n) for a natural number n is ...

#questio#A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concate

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