User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 456,595 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,443 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 1002 | Replies: 10
Reply
Join Date: Sep 2007
Posts: 12
Reputation: hassan_kh is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
hassan_kh hassan_kh is offline Offline
Newbie Poster

Pls Help

  #1  
Sep 6th, 2007
Given that input_time actually represents an integer value in seconds since the epoch - and has the value 0 at precisely "Thu Jan 1 00:00:00 1970", write a better implementation of this function.

1: unsigned long normalise(unsigned long input_time)
2: {
3:
4: bool finished;
5:
6: // This produces a formatted time string like:
7: // Thu_Nov_24_18:22:48_1986
8: string str_time = format_time( input_time );
9:
10: while( str_time.substr(1,3) != "Sun")
11: {
12: input_time -= 24*60*60;
13: str_time = format_time( input_time );
14: }
15:
16: while( str_time.substr(11,2) != "00" )
17: {
18: input_time -= 60*60;
19: str_time = format_time( input_time );
20: }
21:
22: while( str_time.substr(14,2) != "00")
23: {
24: str_time = format_time( input_time );
25: input_time -= 60;
26: }
27:
28: while( str_time.substr(17,2) != "00")
29: {
30: input_time -= 1;
31: str_time = format_time( input_time );
32: }
33:
34: return input_time;
35: }
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2007
Posts: 321
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Rep Power: 3
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: Pls Help

  #2  
Sep 6th, 2007
Stop spamming with the same thing, please. All of your questions are pretty much impossible to answer as given, and it seems like you're trying to get free homework help.
The truth does not change according to our ability to stomach it.
Reply With Quote  
Join Date: Jun 2007
Posts: 321
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Rep Power: 3
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: Pls Help

  #3  
Sep 6th, 2007
The truth does not change according to our ability to stomach it.
Reply With Quote  
Join Date: Sep 2007
Posts: 12
Reputation: hassan_kh is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
hassan_kh hassan_kh is offline Offline
Newbie Poster

Pls Help

  #4  
Sep 6th, 2007
Using any programming language of your choice, implement algorithms to:


a) Reverse a string

b) Sort an array of Integers
Reply With Quote  
Join Date: Aug 2005
Posts: 4,832
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 324
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: Pls Help

  #5  
Sep 6th, 2007
Is this a statement?
Reply With Quote  
Join Date: Sep 2007
Posts: 12
Reputation: hassan_kh is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
hassan_kh hassan_kh is offline Offline
Newbie Poster

Re: Pls Help

  #6  
Sep 6th, 2007
I have not written the function. I was asked this question by a friend which he had got in an interview. These days I am trying to solve as many questions as possible as I learn more from it. If the question is not clear then I can re-send it with exact words.
Reply With Quote  
Join Date: Jun 2007
Posts: 321
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Rep Power: 3
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: Pls Help

  #7  
Sep 6th, 2007
These days I am trying to solve as many questions as possible as I learn more from it.
You're not solving anything by asking someone else do to it. And you're not learning anything either. _And_ you're spamming.
The truth does not change according to our ability to stomach it.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,541
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Pls Help

  #8  
Sep 6th, 2007
>> write a better implementation of this function.
You do it, we don't have the time. Of course if you would pay me $5,000.00 I will do it for you
Last edited by Ancient Dragon : Sep 6th, 2007 at 6:33 pm.
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Join Date: Sep 2007
Posts: 12
Reputation: hassan_kh is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
hassan_kh hassan_kh is offline Offline
Newbie Poster

Re: Pls Help

  #9  
Sep 6th, 2007
as i described b4 ,I was asked this question by a friend which he had got in an interview.Thnx anyway.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,541
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Pls Help

  #10  
Sep 6th, 2007
Originally Posted by hassan_kh View Post
as i described b4 ,I was asked this question by a friend which he had got in an interview.Thnx anyway.


Not an excuse. You should follow forum rules regardless of who originally asked the question.
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 6:52 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC