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

Algorithms, write an algorithm for multiplication of two sparse matrices us...

write an algorithm for multiplication of two sparse matrices using linked lists

How comment symbols help in debugging the code, How does placing some code ...

How does placing some code lines between comment symbols help in debugging the code? - Placing comment symbols /* */ around a code separates some code that coder believes might

Blackjack Game help, I can''t figure out how to stop the programming from h...

I can''t figure out how to stop the programming from hitting for the player even when they type in stand.

Define name mangling in c++??, A: The procedure of encoding the parameter t...

A: The procedure of encoding the parameter types along with the function/method name into a unique name is called as name mangling. The inverse procedure is called demangling. F

Explain relational operators, Relational Operators A relational operato...

Relational Operators A relational operator is used to make comparison among two values. All these operators are binary and needs two operands. There are the following relationa

Assigment, C++ Programming Assignment ATM Machine Phase 1 In this assign...

C++ Programming Assignment ATM Machine Phase 1 In this assignment you will create a program that allows a user to do the following: 1) Create a bank account by supplying a use

C program to print l diagonal triangle, C program to print L diagonal trian...

C program to print L diagonal triangle: void main() {                 int i=0,j=0;                 int arr[rows][cols];                 for (i=0; i

Explain the goto statement, The goto statement This statement can be us...

The goto statement This statement can be used to branch to another statement of the program. This is rarely used as it violates the principle of structured programming. Though

Program to show the ascii value of characters, Program to show the ascii va...

Program to show the ascii value of characters: int main() {                 int one_char;                 cout                 one_char = getch();

Pointer, how to use a pointer variable?

how to use a pointer variable?

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