Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

MET 111 Computer and Programing Dr.

Abdelhady Mostafa

MET 111 Assignment #4 Structure

1. What does the following piece of code print?


int main()
{
enum channel {star, sony, zee};
enum symbol {hash, star};
int i = 0;
for (i = star; i <= zee; i++)
cout << i;
return 0;
}

2. Consider the following enumeration enum colors {black, blue,


green, cyan, red, purple, yellow, white}; Declare a variable of
this type and assign it to the value red.

3. Consider the following structure struct time {int hrs, mins, secs};
Define a structure variable time_now and initialize it to the current time at your
clock.

4. Create a structure called Volume that uses three variables of type Distance to model
the volume of a room. Initialize a variable of type Volume to specific dimensions
(Initialize), then calculate the volume it represents, and print out the result.

5. Write a Program to check Time Difference. Create a structure called time


that contains three members (Hours, minutes, Seconds). Ask the user to
Enter the starting and stopping time. Then, the program will will display the
difference in the same format hours, minutes and seconds.

Enter the starting time in (Hours: Minutes: Seconds)


3
12
45
Enter the Stopping time in (Hours: Minutes: Seconds)
5
10
11

You might also like