#include <locale.h>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
main()
{
char locale[31];
char *ploc_str;
int c;
time_t system_time;
char time_text[81];
printf("Enter locale name: ");
/*1*/ scanf("%30s%*c", locale);
/*2*/ ploc_str = setlocale(LC_ALL, locale);
if (ploc_str == NULL) {
printf("Can't establish locale \"%s\"\n", locale);
return 0;
}
printf("Established locale \"%s\"\n", locale);
printf("Enter a single character: ");
/*3*/ c = getchar();
/*4*/ printf("Character '%c' %s alphabetic\n", c,
isalpha(c) ? "is" : "is not");
/*5*/ printf("The value 12.345 is written as %.3f\n", 12.345);
system_time = time(NULL);
/*6*/ strftime(time_text, sizeof(time_text), "%x %A %B %d\n",
localtime(&system_time));
printf(time_text);
return 0;
}