General discussion

Locked

C Programming question, Please Help!

By meno ·
What up peoples. I despirately need to know if any one can briefly explain to me the process of writting small C program that would accepts a user-entered time in hours and minutes, then have the program display the time one minute later.

Thank You
HyMeno

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

hints

by Jay Eckles In reply to C Programming question, P ...

I won't write the program for you, but here's a few places to start:
look at scanf() or something similar to accept the input
look at time() and the time_t structure to deal with time
look at printf() or something similar to display output.
These are all standard library functions. You should not have any trouble with this assignment if you know C.

Good luck.

Jay
www.jayeckles.com

Collapse -

The program

by mmmova In reply to C Programming question, P ...

this is a fairly simple program. Here is the coding....Hope it will work

include<stdio.h>
include<conio.h>
include<dos.h>

void main()
{
int hours,min;

printf("\nEnter current hours and minutes: ");
scanf("%3d:%3d,&hours, &min);
delay(60000); //time is given in millisecs
++min;
clrscr();

printf("\nThe current time is %d hours and %d minutes",hours,min);

getche();

}

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Software Forums