C++ :: School Project - Getting Current Date And Time

Dec 30, 2014

I am doing a school project. The project basically is that it records the in and out time of an employee(of an particular company).The employee while checking in or out should enter a unique key generated specially for him so that no one else can check in and out for him.Then referring to the employees position( A worker or a manager or something like that) his total working time each day , for a week and a month is calculated. The company starts at 8 am and ends at 5 pm for 1st shift and for second shift from 3.30 pm to 2.30 am. Plus Saturday and Sunday off. Then after a month the program refers to the working time date stored in a file and calculates his pay(For workers its per hour salary and for managers it aint).

If an employee is consistently late the details are forwarded to the HR account( so that necessary steps are taken).This will support the company log the details of their employees duty time plus give enough detail to take action if someones always late. I'm doing this as a school project and it needn't be of enterprise class and all.. But i want the coding to perform as it should. Also i'm forced to use the old Turbo C++. Now i'm struck in the place where the time of the employees in and out time is logged. This coding does the work

Code:
void main( ) {
clrscr();
char dateStr [9],timeStr [9];
_strdate( dateStr);
cout<<" The current date is "<<dateStr<<'

[Code] ....

I think the second one is better as it not only gives me date but also gives me the day so i can check easily for the weekends. So, how these time functions work.

View 1 Replies


ADVERTISEMENT

C/C++ :: Save The Current Date And Time Into A Char Array?

Jan 14, 2015

I am trying to use to save the current date and time into a char array using this code:

char current_time(char *date){
time_t result = time(NULL);
date = ctime(&result);
return *date;
}
main{

[Code]...

now when I output the date char array into a txt file I only get gibberish.

View 6 Replies View Related

C :: Display Current Time And Date In Program And Use Variable To Store Each Of Values

Feb 16, 2013

i need to display the current time and date in my program and use variable to store each of the time values like

a = 10
b = 29
c = 31

printf(``%d : %d : %d``, a,b,c);

which then give the output as - 10:29:31

How to save the time in variables in C....

i am using C in windows 7 and my complier is Bloodshed Dev C++

View 7 Replies View Related

C++ :: Interactive Loan Calculator For School Project

Jun 6, 2014

I'm trying to build an interactive loan calculator for a school project. These are the requirements:

Your program should do the following:
•Display a Welcome title for the Loan Calculator
•Prompt the user to enter the price of the car
•Prompt the user to enter the length of the term in months
•Prompt the user to enter the APR in percentage (e.g. 4.79%) - without the percent sign of course

Your program should then report with the monthly payment will be.

Use setw() and setfill() to display the content like a receipt. All the data should be neatly displayed.

Example

For a Friend Loan Calculator

Price of Vehicle: $25,000
Term of Loan (in months): 60
APR in percentage (e.g. 4.79% - without the percent sign): 3.8
--------------------------------------------------------------
Total Monthly Payments: $433.50 //NOT ACCURATE

Display all money totals (output values) to two decimal places. You should output an accurate result as well.

For extra credit you may factor in a state auto sales tax of 6.5% of the purchase price of the vehicle and how much of a down payment the user would like to put down. Of course, if you are factor down payment, you must prompt the user to enter that amount.

I attempted to build one but I'm getting a lot of errors using Microsoft visual studio. Here it is below:

Interactive Loan Calculator

#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;

int num1,
num2,
response,

[Code] .....

View 3 Replies View Related

C Sharp :: Time Table Of School?

Mar 22, 2013

I have project "Time Table of school". How it possible logically as well as visually in .NET. it contain all teachers name and their periods. when any one absent then we enter the name of teacher or course name, highlight the absent teacher periods and then generate arrange period list and print it. when it highlight timetable we click on them and show all other teacher names who are free at this time.......

what controls are need in .NET with c#. it will be desktop application,

View 10 Replies View Related

C++ :: Adding Current Date To The End Of A String

Dec 12, 2014

I need to add the current date to the end of a string but I only need to add the day and not the year or month.

Put the code This is what i have

char date[9];
_strdate(date);
cout << date << endl;

View 1 Replies View Related

C/C++ :: Assigning Current Date To Integer Values

Sep 26, 2014

How can i assign current date as integer ?

for example:

today's date 26 Sep 2014 on a computer
i try to make as below
int day=26
int moth=9
int year=2014

I also research i think i will use time.h library surely

View 3 Replies View Related

C++ :: Calculate Approximate Age Of User Based On Current Date And Their Birthday

Nov 23, 2012

I have an extra credit project where I'm supposed to calculate an approximate the user's age based on the current date and their birthday. My problem is that I am not getting the proper date and time. C++ keeps giving me some random date. I looked up c++ time format on the internet because this is extra credit and not in my book.

I am currently using dev C++ 4.9.9.2. Here is my current code :

// included libraries
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <time.h>
#define cls system("cls")
#define pauseOutput system("pause")
void printM(int x);
void age(int m, int d, int y, int &yearAge, int &monthAge, int &dayAge);

[Code] ....

View 1 Replies View Related

C++ :: Create A Program Which Prompts For User Input Of Current And Birth Date

Sep 27, 2014

I have an assignment in which i must create a program which prompts for user input of current and birth date, which will compare said dates and output if its your birthday or not. I've completed a large portion of it, but cannot figure out how to get the user input of month as an integer such a 2 into February.

#include <iostream>
using namespace std;
class DayOfYear {
public:
void input();

[code]....

View 1 Replies View Related

C++ :: Program To Display AM/PM With Current Time?

Feb 14, 2013

I'm trying to display the AM/PM on my program:

Also is there a way to display the time only instead of the date? How will i change the program to display the time in standard 12 hours, instead of 24 hours?

#include <iostream>
#include <time.h>
using namespace std;
int main()
{
time_t tim;
time(&tim);
cout << ctime(&tim);
}

View 1 Replies View Related

C/C++ :: Get Current Time And Write It To A File?

Jul 19, 2013

i have to write the current time to a file ?how to do it

View 2 Replies View Related

C :: Printing Current TIME At Regular Intervals

Aug 22, 2013

Its a code in module of my program, where I need to print current time (HH:MM:SS) at regular intervals.

Code:
#include<time.h>
#include<stdio.h>
//#include<windows.h>
void delay(unsigned int t){ // loop for some delay.

[Code] ....

But when I am running this code I expect this to print difference in time due to delay. But it doesn't enter the delay loop, why ?

View 5 Replies View Related

C++ :: Date And Time As A String?

Aug 28, 2014

This is what I have:

#include <ctime>
#include <string>
using namespace std;
void date_and_time(string &date, string &time){
time_t current_time;

[Code] ......

Is there a way to make sure that the strings would not contain trailing spaces?

View 1 Replies View Related

C/C++ :: How To Get System Date And Time And Display It

Mar 16, 2012

How to get system Date and Time and display it in the format DD/MM/YYYY ??

View 2 Replies View Related

C++ :: Class Constructor To Create Date And Time?

Mar 13, 2014

I am trying to create two classes: a Date class and a Time class. The Date class has to have three private data members: day, month and year. The Time class should have two private data members:hour and minute. Each class should have two member functions: a constructor and display. I am lost and my code won't run ....

class Date {
private:
int month, day, year;
public:
Date(int m, int d, int y){
month = m;
day = d;
year = y;

[code]....

View 2 Replies View Related

C++ :: Program Which Takes Date And Time Input From The User

Jan 20, 2013

I am writing a C++ program which takes date & time input from the user. This is then parsed into a struct such as:

struct time
{
short year;
short month;
short day;
short hour;
short min;
};

My question is: how can I convert such a struct into a time_t object, which is an unsigned long giving the time as the number of seconds elapsed since the epoch Jan 1st 1970, 00:00, as set out in time.h.

I am wondering if this can be achieved using the standard library, or whether I just need to write a function to perform the appropriate arithmetic.

View 2 Replies View Related

C Sharp :: Show Only Date Not Time In Visual Studio

Feb 1, 2013

How to show only current date not time in webforms in visual studio as for date and time code is

Label1.Text = DateTime.Now.ToString();

What for only date not time

View 3 Replies View Related

C Sharp :: Compare Date In Registry With Local Time?

Feb 2, 2013

The first time my application opens up, it should get the local date out of the System and store this in a registry key. But the second time it should get the date stored in that registryKey and compare it to the date right now.And there is where I am stuck, I just don't know how to get the date out of that key and compare it to the date right now.

This is my code:

RegistryKey key1;  
        private void btnTrial_Click(object sender, EventArgs e) {
            DateTime current = DateTime.Now;  
            key1 = Registry.CurrentUser.OpenSubKey("myKey");    
            if (key1 == null)

[code]....

at the last "if" statement it should compare the date stored in the key with the DateTime.Now.

View 9 Replies View Related

Visual C++ :: Compile Time Errors For OpensSSL In Project

Feb 4, 2014

I am trying to build a VC++ project in Visual Studio 2010. [URL] ....

This project has a dependency on openssl libraries. How can I successfully build this project? How to add third party libs/dlls in a project.

View 1 Replies View Related

C :: Program To Take Time And Date Typed By User And Increase It By 1 Minute

Mar 22, 2013

I'm having a problem with my homework. The task is to write a program that will take time and date typed by user, and increase it by 1 minute. I should write 3 functions - first calls second function that updates time and calls third function, if time is 00:00.Time update works, but date update does not.My whole written code:

Code:

#include<stdio.h>
struct DateAndTime {
struct date {
int day;
int month;
int year;

[code]....

I should check if inputs are numbers only, so I tried including isdigit function from ctype.h library, but that didn't work either, after I was trying it for a good hour or so, but I kinda rage quit that...

View 8 Replies View Related

C Sharp :: Generate Automatic Alerts With Snooze Time Before Targeted Date And Day Before

Nov 20, 2012

i want to create an application which generates popup alerts at the day of event occurs as well as a day before the event will occur in a specific time interval as well.. events are stored in database and they are all date time fields .. so i want to link those fields to create popups ..

View 2 Replies View Related

C Sharp :: How To Pick Date / Time When Serial Port Starts Reading And Also When Stops

Aug 18, 2014

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Ports;

[Code] ....

How to pick date / time when serial port starts reading , and also when reading stops ?

View 2 Replies View Related

C/C++ :: Given Person Birth-date Or Any Other Date Will Display Day Of Week

Oct 11, 2012

i'm making a program that, given a person's birthdate or any other date, will display the day of the week of the person was born.

There is this part where it says "use a switch statement to make this calculation, If desired month is 12, add the number of days for November, if desired month is 11 add the number of days for october....

So it's suppose to start with "case 12 :...

I can't figure out what to write for the statement....

View 6 Replies View Related

C++ :: Two Date Structures Sharing Same Date

Mar 28, 2014

I have two date/time structures which I'm populating, but when I populate the second one it sets the same values in the first. This is what I've got so far

tm *FirstDate = gmtime(&now);
tm *SecondDate = gmtime(&now);

cout <<"Enter your first date in the format dd/mm/yyyy" << endl <<">";
getline (cin,tempstring);

[Code] .....

View 2 Replies View Related

C# :: Opening A Second Form Project Within A Project

Jan 22, 2014

I have a project which does a specific thing, like an open file dialog.

I would like to open it in a different project on a click of a button.

Also, It has a different namespace.

I'm guessing that it would involve a "using" statement to add the namespace And I will have to add reference to an *.exe or *.dll -> I'll have to look up how to make a *.dll, I know where the *.exe file is.

I have searched for a different things on Google, but I don't think that I am looking for the correct phrase (which is always frustrating...)

View 12 Replies View Related

C/C++ :: Round Robin Execution With Gantt Chart - Arrival Time And Burst Time

Mar 10, 2015

This is a round robin execution. with gantt chart. arrival time and burst time. I think there is an error in my formula to get the right answer,i cant resolve it but my program is running. What is the code or the right formula??

#include<stdio.h>
int main(){
int i,j=0,n,time,remain,flag=0,ts;
int sum_wait=0,sum_turnaround=0,at[10],bt[10],rt[10];
int ganttP[50],ganttStartTime[50];
printf("Enter no of Processes : ");
scanf("%d",&n);
remain=n;

[Code] ....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved