A struct to represent dates is to be implemented

Assignment Help Computer Engineering
Reference no: EM132167234

Using C++

A struct (or object) to represent dates is to be implemented. It must contain a string for the day of the week, and three numbers for the day of the month, the month, and the year.

Part A. Give the struct definition, along with a suitable set function for initialising a date, and a print function that prints one nicely.

Using your definitions, I should be able to write this:

date today, st_swithins_day;

set(today, "Tuesday", 22, 11, 2011); set(st_swithins_day, "Friday", 15, 7, 2011); print(today);

and when run, that code should print something very close to this

Tuesday 22nd November 2011

or this

Tuesday November 22nd 2011

Part B. Define a function called latest, which takes two dates as parameters, and returns as its result the one that is latest (i.e. comes second). So for example, this

date x = latest(today, st_swithins_day);

print(x)

should also print today's date.

Part C. Define a function called next, which takes one date as its parameter, and modifies that date by moving it on to the next day, so this

next(today);

print(today);

next(today);

print(today);

would print

Wednesday November 23rd 2011

Thursday November 24th 2011

Reference no: EM132167234

Questions Cloud

Write a subprogram that stores values into two arrays : write a subprogram that stores values into two arrays.One of the arrays will hold printable ASCII characters and the other will hold associated integer values.
What is the probability that your friend gets a greek yogurt : What is the probability that your friend gets a Greek yogurt and that you get a vanilla yogurt?
Write a void function that takes no parameters : Write a void function that takes no parameters and will open a binary file called dvalues.xem to find the highest, the smallest and the mean of all the file.
What is the probability that both stocks : a. What is the probability that both stocks will appreciate during the period? b. What is the probability that A will appreciate but B will not?
A struct to represent dates is to be implemented : Define a function called latest, which takes two dates as parameters, and returns as its result the one that is latest (i.e. comes second).
Create the income statement balance sheet : Using the Attached Apollo Shoes Analytical file need to create the following: 2017 Income Statement balance sheet based on the pre-closing trial balance
What is the predicted price when the number of pages : What is the predicted price when the number of pages is 75? Enter your answer as dollar and cents.
How to calculate the mean : How to calculate the mean when raw score is 65, SD is 4.0, and z-score is +.75?
Find the standard deviation for a set of ungrouped data : Using C++ write a group of functions to find the Standard Deviation for a set of ungrouped population data.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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