Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,167 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,893 people online right now. Registration is fast and FREE... Join Now!




Using dates to determine the time elapsed

 
Reply to this topicStart new topic

Using dates to determine the time elapsed, I need to figure out how long the deposit was in the bank

wowhesawesome
14 Dec, 2007 - 10:11 AM
Post #1

New D.I.C Head
*

Joined: 9 Nov, 2007
Posts: 14


My Contributions
I need to subtract the beginning date from the date entered to determine the amount of time a deposit was in the bank to determine interest.

Here is what i have so far using some of my similar assignments

CODE

#include <stdio.h>
#include <time.h>

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  printf ( "The current date/time is: %s", asctime (timeinfo) );

  return 0;
}

*edit: Please use code tags in the future. Thanks again! code.gif

This post has been edited by Martyr2: 14 Dec, 2007 - 10:26 AM
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Using Dates To Determine The Time Elapsed
14 Dec, 2007 - 10:26 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,226



Thanked: 37 times
Dream Kudos: 25
My Contributions
That will provide the system time. Will you be using system time in your application? Or asking the user for dates?
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 12:10AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month