i have written a series of programs in c++ that do various things with dates and the likes, i now have to write a piece pseudo-code that can be used for data checking, abit stuck on how to even start.

BEGIN
CALL validDate = true

CALL validmonth = true
IF m >12 or m < 1 = false
THEN
RETURN
CALL validDay = true
IF d > 31 or d < 1 = flase
THEN
RETURN

i have something like this at the monemt, but i have no idea if i am even heading in the right direction any help would be much appreciated

Recommended Answers

All 3 Replies

I don't understand, if you know c++, this shouldn't be an issue at all... you pretty much just need to add some braces.

Dave

How would you write it in C++? Pseudocode is very freeform, just describe how you would do it in C++. Just don't make it the formal C++ syntax.

I'd do something more along the lines of

IF m >12 or m < 1 then 
        return invalidmonth
IF d > 31 or d < 1 then
        return invalidday
etc
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.