![]() |
| | #1 |
| Registered User Join Date: Jun 2009
Posts: 4
| Local Time Program Code: //Local time - Determine the local time for the city given in user input
#include <iostream>
#include <cstdlib>
#include <string.h>
#include <cstdio>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// Header to program
cout << "**************************************" << endl;
cout << "**********Local Time Program**********" <<endl;
cout << "**************************************" << endl << endl;
char dateStr [9];
char timeStr [9];
_strdate( dateStr);
// Display the current date and time given on the computer
printf( "The current date is %s \n", dateStr);
_strtime( timeStr );
printf( "The current time is %s \n", timeStr);
cout << endl << endl;
// Ask user for city
string city;
cout << endl << "Enter the city you would like the time for: ";
cin >> city;
}
Thanks in advance for the help. |
| Ronzel is offline | |
| | #2 |
| and the hat of vanishing Join Date: Aug 2001 Location: The edge of the known universe
Posts: 21,214
| Read up on localtime() gmtime() mktime()
__________________ If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut. Up to 8Mb PlusNet broadband from only £5.99 a month! |
| Salem is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| little program to get time from log | repu1sion | C Programming | 4 | 07-06-2009 10:05 AM |
| How to time how long a program takes to run? | advancedk | C Programming | 2 | 08-18-2008 07:50 PM |
| Creating local variables in a program? | fl0at | C Programming | 5 | 01-04-2008 07:34 PM |
| Using variables in system() | Afro | C Programming | 8 | 07-03-2007 12:27 PM |
| BOOKKEEPING PROGRAM, need help! | yabud | C Programming | 3 | 11-16-2006 11:17 PM |