Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <locale.h>
- int main() {
- setlocale(LC_ALL, "rus");
- char s[50];
- printf(" \n Введите число -> ");
- gets(s);
- char *whole, *fract;
- int length;
- if (isdigit(*s) != 0) {
- whole = strtok(s, ".");
- printf("%s.", whole);
- fract = strtok(NULL, ".");
- printf("%s\n", fract);
- length = strlen(fract);
- if(length >= 7) {
- printf("Введено число типа double\n");
- } else {
- printf("Введено число типа float\n");
- }
- }
- else {
- printf("Введенная строка не является вещественным числом\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement