- Define a new type called POINT that is a structure consisting of two fields, x and y , both of type double .
struct POINT
{
double x;
double y;
};
- Define a new type called POINT3D that is a structure consisting of three fields, x , y and z , each of type double .
struct POINT3D
{double x,y,z;};
- Define a new type called ADDRESS that is a structure consisting of seven fields, suiteNumber , streetNumber , street , city , province , postalCode , country , all of type string .
struct ADDRESS
{
string suiteNumber,streetNumber, street, city, province, postalCode,country;
};
- Define a new type called DATE that is a structure consisting of three int fields, dayOfMonth , month and year .
struct DATE{
int dayOfMonth,month,year;};
- Assume that the type NAME has already been defined. Define a new type, SREC that is a structure consisting of two fields: name (a NAME ) and grade (a string ).
struct SREC
{
NAME name;
string grade;
};
- Declare a structure whose tag name is Book and that contains exactly three fields (or members), each of type int. The first field is nCopies, the second field is nPages and the third field is nAuthors.
struct Book
{
int nCopies, nPages, nAuthors;
};
- Declare a structure whose tag name is DrawnLine and that contains exactly two fields (or members). The first field is letter and is of type char, the second field is number and is of type int.
struct DrawnLine
{
char letter;
int number;
};
- Declare a structure whose tag name is Money and that contains exactly two int fields, dollars and cents.
struct Money
{
int dollars, cents;
};
- Declare a structure whose tag name is Server and that contains the following fields: manufacturer, a string, model and serialnum, both also strings, year, an int, clockSpeed, a double, cores, an int, ram, an int and finally storage an int.
struct Server
{
string manufacturer, model, serialnum;
int year,cores,ram,storage;
double clockSpeed;
};
- Given the declaration of a structure whose tag is Book write the declaration of a Book variable, bestSeller.
Book bestSeller;
- Given the declaration of a structure whose tag is ADDRESS, write the declaration of two ADDRESS variables, billing and shipping.
ADDRESS billing;
ADDRESS shipping;
- Given the declaration of a structure whose tag is DATE write the declaration of the following variables enrolled_on, paid_on, and completed_on, each of which is of type DATE..
DATE enrolled_on, paid_on,completed_on;
- Given a structured type Money declare the following variables of that type: revenue, expenses, and profit.
Money revenue, expenses, profit;
THANKS A LOT HELPED ME LOT!!
ReplyDeletejah bless
ReplyDeleteA Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
ReplyDeletewebsite: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well
ReplyDeleteexplained computer science and programming articles, quizzes and practice/competitive
programming/company interview Questions.
website: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well
ReplyDeleteexplained computer science and programming articles, quizzes and practice/competitive
programming/company interview Questions.
website: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well
ReplyDeleteexplained computer science and programming articles, quizzes and practice/competitive
programming/company interview Questions.
website: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well
ReplyDeleteexplained computer science and programming articles, quizzes and practice/competitive
programming/company interview Questions.
website: geeksforgeeks.org
A Computer Science portal for geeks. It contains well written, well thought and well
ReplyDeleteexplained computer science and programming articles, quizzes and practice/competitive
programming/company interview Questions.
website: geeksforgeeks.org