[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

typical problem in C++... hot to solve

@$|-|. DUBEY

12/11/2008 9:47:00 AM

hello every one.
i have this problem in c.

i have to check that the input date doesnot exceed the tomorrow date.
eg. if input date = 12-10-2004
then it should be always less than 12-12-2008
because today is 11-12-2008.

and input date should be valid one.
like jan is 30 days.
dec is 31 days.
feb is 28 ( if not leap year)....

how to solve this problem
10 Answers

Ian Collins

12/11/2008 10:21:00 AM

0

@$|-|. DUBEY wrote:
> hello every one.
> i have this problem in c.
>
> i have to check that the input date doesnot exceed the tomorrow date.
> eg. if input date = 12-10-2004
> then it should be always less than 12-12-2008
> because today is 11-12-2008.
>
> and input date should be valid one.
> like jan is 30 days.
> dec is 31 days.
> feb is 28 ( if not leap year)....
>
> how to solve this problem

By writing some code. What have you tried?

--
Ian Collins

@$|-|. DUBEY

12/11/2008 10:37:00 AM

0

On Dec 11, 3:20 pm, Ian Collins <ian-n...@hotmail.com> wrote:
> @$|-|. DUBEY wrote:
> > hello every one.
> > i have this problem in c.
>
> > i have to check that the input date doesnot exceed the tomorrow date.
> > eg. if input date = 12-10-2004
> > then it should be always less than 12-12-2008
> > because today is 11-12-2008.
>
> > and input date should be valid one.
> > like jan is 30 days.
> > dec is 31 days.
> > feb is 28 ( if not leap year)....
>
> > how to solve this problem
>
> By writing some code.  What have you tried?
>
> --
> Ian Collins

since i am working on this embedded thing.
i don't have lot of option....
but i am trying hard...
some help could be more better.
i can access local date...
i have input date.
now i have to find algorithm to sort the date....

Ron AF Greve

12/11/2008 12:19:00 PM

0

Hi,

Can't you just concatenate the dates like this
YYYYMMDD
Date1BeforeDate2 = date1 < date2

To validate input dates you might want to look at mktime (but not sure if
you can validate time with it).

If I have a database server around (for instance oracle) I usually abuse the
sysdate function to generate or test dates (but I guess that is not an
option for embedded stuff).

Regards, Ron AF Greve

"@$|-|. DUBEY" <dubey.ashwini@gmail.com> wrote in message
news:0b579a8f-0fc4-4b51-8707-16d65d84f11c@q26g2000prq.googlegroups.com...
> hello every one.
> i have this problem in c.
>
> i have to check that the input date doesnot exceed the tomorrow date.
> eg. if input date = 12-10-2004
> then it should be always less than 12-12-2008
> because today is 11-12-2008.
>
> and input date should be valid one.
> like jan is 30 days.
> dec is 31 days.
> feb is 28 ( if not leap year)....
>
> how to solve this problem


webdoggy2

12/11/2008 2:05:00 PM

0

Message: sorry for bothering you i was just wondering if you could
help me with a poker game that i have to create.I used an array to a
class in order to create different players.I have to create a function
that saves the status of the game like nWins, money and so on, but im
not sure how to do this.

Thanks

void savePlayerData(clPlayer *playerData)
{
int x;
ofstream playerdata("playerdata.dat");
playerdata<<playerData[x].money<<playerData[x].nWins<<playerData
[x].nGamesPlayed
<<playerData.totalAmountWon<<playerData.totalAmountBet;

Ron AF Greve

12/11/2008 3:29:00 PM

0

Hi,

Lookup object serialization either in this newsgroup or using google.

Regards, Ron AF Greve

"webdoggy2" <webdoggy2@gmail.com> wrote in message
news:86b99329-76e7-4927-908f-eb82915400a1@e21g2000vbe.googlegroups.com...
> Message: sorry for bothering you i was just wondering if you could
> help me with a poker game that i have to create.I used an array to a
> class in order to create different players.I have to create a function
> that saves the status of the game like nWins, money and so on, but im
> not sure how to do this.
>
> Thanks
>
> void savePlayerData(clPlayer *playerData)
> {
> int x;
> ofstream playerdata("playerdata.dat");
> playerdata<<playerData[x].money<<playerData[x].nWins<<playerData
> [x].nGamesPlayed
> <<playerData.totalAmountWon<<playerData.totalAmountBet;
>


red floyd

12/11/2008 5:27:00 PM

0

On Dec 11, 1:47 am, "@$|-|. DUBEY" <dubey.ashw...@gmail.com> wrote:
> [do my homework redacted]

Your answer can be found at http://www.parashift.com/c++-faq-lite/how-to-post.ht...

Vaclav Haisman

12/11/2008 5:41:00 PM

0

@$|-|. DUBEY wrote, On 11.12.2008 11:37:
> On Dec 11, 3:20 pm, Ian Collins <ian-n...@hotmail.com> wrote:
>> @$|-|. DUBEY wrote:
>>> hello every one.
>>> i have this problem in c.
>>> i have to check that the input date doesnot exceed the tomorrow date.
>>> eg. if input date = 12-10-2004
>>> then it should be always less than 12-12-2008
>>> because today is 11-12-2008.
>>> and input date should be valid one.
>>> like jan is 30 days.
>>> dec is 31 days.
>>> feb is 28 ( if not leap year)....
>>> how to solve this problem
>> By writing some code. What have you tried?
>>
>> --
>> Ian Collins
>
> since i am working on this embedded thing.
> i don't have lot of option....
> but i am trying hard...
> some help could be more better.
> i can access local date...
> i have input date.
> now i have to find algorithm to sort the date....
If you can use Boost then use it and its excelent DataTime library.

--
VH


@$|-|. DUBEY

12/12/2008 9:58:00 AM

0

well people i got it....
and good thing is i solved this problem my self.

here is what i have done....
correct me if i am wrong any where.

i have current date... ddmmyyy ( 12/12/2008 )
i have user date....ddmmyyy ( 14/03/1983 )
i reversed the both date to yyyddmm
so i get....

m_crnt_date = 20081212;
m_my_dob = 19831402;

since both are converted to integer formate
it can be compared....
if( m_my_dob >= m_crnt_date )

that's done...


MattB.

2/1/2012 6:30:00 AM

0

On Tue, 31 Jan 2012 21:07:41 -0800 (PST), Richard Steel
<rsteel2525@aol.com> wrote:

Here you go next time I an just give you this link.


http://groups.google.com/group/alt.society.liberalism/msg/720a34a2db0f...

Still waiting for proof?

Richard Steel

2/1/2012 6:47:00 AM

0

On Jan 31, 10:09 pm, MattB. <trdell1...@gmail.com.......> wrote:
> On Tue, 31 Jan 2012 21:07:41 -0800 (PST), Richard Steel
>
>
>
>
>
>
>
>
>
> <rsteel2...@aol.com> wrote:
>
> >> >> >> >And yet you insist that these men would allow a pale skinned, slack
> >> >> >> >jacked nobody to simply steal their reputations and honor without a
> >> >> >> >word of protest?
>
> >> >> >>     Where was this done?
>
> >> >> >When you claimed to be a Navy Seal.
>
> >> >>    So you have seen my records?
>
> >> >You once told me that you hadn't ever earned a military honor.  You
> >> >then claimed to have been a Navy Seal.
>
> >>   You ever think maybe you misunderstood.
>
> >Quite certain that I didn't.  I asked you several times, and gave you
> >every chance to back off from the lies.  You chose to double down.  Of
> >course, you never settled down on a single story - you alternated
> >between cop and Navy Seal - and you've never straighten out idea you
> >were retired/active duty/retured but you took monthly meetings
> >nonsense.

> Nothing to back down from.   I've made it plain I was never a cop.

After strongly implying that you were.

 I
> have never worked for a local authority.

You've never been in the military, either.

> Lets see if you can understand this.

I have no problem understanding at all - you're a lying sack of shit.

>  A person retires from the Navy,

No. A Seal never "retires". A Seal is forever.

> then starts a business, then retires but is still a major owner so
> goes to meetings similar to a stock holder meeting.  A person can
> leave the day to day operations to others yet is still a owner.

Except you said you went to meetings as a Seal.

> When
> my son graduates I might if he wants transfer that responsibility to
> him.  Until that day I am retired with responsibilities.

Son? In the earlier version of this lie, you had a daughter. Perhaps
you should keep a notepad to help keep your story straight.

> Monthly meeting no.

But you said you did. Of course, you claimed the meetings were with
the Navy Seals.

> There even you should be able to understand that.

Again, I understand it perfectly. You're a lying sack of shit.

> >>   Some people don't like to
> >> tell such things on a public NG.
>
> >And yet you did exactly that several times.  Nobody held a gun to your
> >head.

>   Then what is my full name?

Who cares?

> >> You do not have a right to peoples
> >> personal information.
>
> >Big talk from a pathological liar who demanded I prove that my father
> >served in the Marines.

>     Personally that doesn't matter.

And yet you demanded that I prove my Father's service.


> >> >You might as well have written that you're President of the United
> >> >States, but you've never run for office.  I suppose there are some
> >> >people who manage to get an Honorable Discharge without ever winning
> >> >some sort of military honor....but I've never met one.  Certainly,
> >> >without question, no one has ever been raised to the heights of Seal
> >> >without earning many honors.  It's the bare minimum requirement.
>
> >> Well maybe you need to think a little.  If everyone has one is it a
> >> honor or just part of he job.
>
> >You didn't say that it didn't matter - you said in never happened.
>
>   No I did not.

I wrote it, I read it.....and nobody else cares.


> >And you said this multiple times.
>
> >Never mind never having served - you've never even seen a movie about
> >the military.
>
>   LOL  seen a few most are not very accurate and the modern ones I
> could not say.

I've never seen ANY military movie that approached your utter
ignorance of that branch of service.

> >> >> >They're Tea Party members - the one you repeated said sucked
> >> >> >testicles, were traitors, and settled on "Tea Billies".  They're also
> >> >> >actual Veterns ... not a lying sack of shit your yourself.
>
> >> >>   Well being a vet doesn't make one perfect.
>
> >> >How would you know?  You only pretend to be vet, remember?
>
> >>    Again where is your evidence?

> >1.  Your story isn't consistent.

>  Try not taking it our of context  LOL

There IS no context. Your stories contradicts themselves.

> >2.  You don't know the first thing about the military.
>
> LOL and how would you know?

Because I grew up in a military household, surrounded by Marines.

> >> >>  Then living where you do.
>
> >> >Now that you've been utterly humiliated and discredited, you start
> >> >with the thinly veiled creepy threats.  Hinting that you have my home
> >> >address, are you?  If so, you know that we have Castle laws in my neck
> >> >of the woods - and I'm heavily armed.  I have guns, and I love
> >> >shooting them.

> >>   LOL   You are crazy.   Do you really think your so important I'd
> >> make a public threat.  ROFL.

> >It's not that I'm important - I'm sure you creepily threaten anyone
> >who calls you on your lies.

>    Well OK.  You have still to prove you right.

You don't actually deny it...you just demand proof that you DIDN'T
mean it.

You try to sound threatening, and just wind up being stupid.

> >>  You have no proof of your accusations as there can't be any.  You
> >> have no credibility on this NG and have no way to effect my life at
> >> all.
>
> >>  Being a X-seal does not make my opinion any better than anyone else.
>
> >Just when I believe that you've hit bottom, you sink lower.
>
> >There is no such thing as a "X-Seal".  I ONCE made the mistake of
> >telling my father that he "used to be a Marine".  I was told, in no
> >uncertain terms, that he IS a Marine.  Once a man is a Seal, he's one
> >for life.
>
> Now there you are right and wrong.

I am correct, and you're a liar.
>   So lets lear this up.  I have not been active for many many years.

Prove it.