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.
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:
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,
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);
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();
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); }
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;
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.
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.
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...
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 ..
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 ?
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....
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
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...)
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;