#include <stdlib.h>
int atoi (const char * str);
#include <stdio.h>
#include <stdlib.h>
int main ()
{
int i;
char buffer[256];
printf ("Enter a number: ");
fgets (buffer, 256, stdin);
i = atoi (buffer);
printf ("The value entered is %d.", i);
system("pause");
return 0;
}
Enter a number: 233cyuyan The value entered is 233.
#include <stdlib.h>
long atol(const char * str);
#include <stdio.h>
#include <stdlib.h>
int main ()
{
long int li;
char buffer[256];
printf ("Enter a long number: ");
fgets(buffer, 256, stdin);
li = atol(buffer);
printf ("The value entered is %ld.\n", li);
system("pause");
return 0;
}
Enter a long number: 1200cyuyan The value entered is 1200.[b] [/b]
#include <stdlib.h>
double atof (const char* str);
#include <stdio.h>
#include <stdlib.h>
int main(){
char *a = "-100.23",
*b = "200e-2",
*c = "341",
*d = "100.34cyuyan",
*e = "cyuyan";
printf("a = %.2f\n", atof(a));
printf("b = %.2f\n", atof(b));
printf("c = %.2f\n", atof(c));
printf("d = %.2f\n", atof(d));
printf("e = %.2f\n", atof(e));
system("pause");
return 0;
}
a = -100.23 b = 2.00 c = 341.00 d = 100.34 e = 0.00
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有