Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- //1
- /*
- typedef struct {
- int id;
- char name[20];
- }Opt1;
- struct Opt2 {
- int id;
- char name[20];
- };
- //2
- struct date {
- int day, month, year;
- };
- typedef struct {
- int day;
- int month;
- int year;
- }date;
- struct date {
- int day, month, year;
- }birthday;
- birthday = {10, 10, 2010};
- //3
- struct time
- {
- int hour, minute, seconds;
- };
- */
- void question3()
- {
- typedef struct{
- int hour, minute, seconds;
- }time;
- time t[2] , t3;
- for (int i = 0; i < 2; i++)
- {
- fprintf(stdin, "Enter Hour:");
- fscanf(stdin, "%d", &t[i].hour);
- fprintf(stdin, "Enter minute:");
- fscanf(stdin, "%d", &t[i].minute);
- fprintf(stdin, "Enter Seconds:");
- fscanf(stdin, "%d", &t[i].seconds);
- }
- t3.hour = t[0].hour - t[1].hour;
- t3.minute = t[0].minute - t[1].minute;
- t3.seconds = t[0].seconds - t[1].seconds;
- printf(" delta time is: %d %d %d", t3.hour, t3.minute, t3.seconds);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement