template.cpp
/// <summary>
/// Handles the input and output of the console to ask the user for a date and time (=moment).
/// The function returns a pointer to the newly created moment.
/// Remember to free() the moment if you don't need it anymore.
/// </summary>

Handles the input and output of the console to ask the user for a date and time (=moment).
The function returns a pointer to the newly created moment.
Remember to free() the moment if you don't need it anymore.
Handles the input and output of the console to ask the user for a date and time ( = moment ) . The function returns a pointer to the newly created moment . Remember to free () the moment if you don ' t need it anymore .
struct moment *readMoment(void) {
	int year, month, day, hour, minute, second;
	printf("%*.*s : ", -INPUT_PROMPT_LENGTH, INPUT_PROMPT_LENGTH, "Date [dd.mm.yyyy]");
	scanf_s("%2d.%2d.%4d", &day, &month, &year);
	printf("%*.*s : ", -INPUT_PROMPT_LENGTH, INPUT_PROMPT_LENGTH, "Time [hh:mm:ss]");
	scanf_s("%2d:%2d:%2d", &hour, &minute, &second);
	struct moment *moment = (struct moment *)malloc(sizeof(struct moment));
	moment->year = year;
	moment->month = month;
	moment->day = day;
	moment->hour = hour;
	moment->minute = minute;
	moment->second = second;
	return moment;
}
struct moment * readMoment ( void ) { int year , month , day , hour , minute , second ; printf ( " " , - INPUT_PROMPT_LENGTH , INPUT_PROMPT_LENGTH , " " ) ; scanf_s ( " " , & day , & month , & year ) ; printf ( " " , - INPUT_PROMPT_LENGTH , INPUT_PROMPT_LENGTH , " " ) ; scanf_s ( " " , & hour , & minute , & second ) ; struct moment * moment = ( struct moment * ) malloc ( sizeof ( struct moment ) ) ; moment -> year = year ; moment -> month = month ; moment -> day = day ; moment -> hour = hour ; moment -> minute = minute ; moment -> second = second ; return moment ; }
<summary>
Handles the input and output of the console to ask the user for a date and time (=moment).
<summary > Handles the input and output of the console to ask the user for a date and time ( = moment ) .
// "Date [dd.mm.yyyy]", // "Time [hh:mm:ss]"