C语言中atio和atof怎么用啊?

[复制链接]
查看11 | 回复1 | 2008-3-20 23:43:17 | 显示全部楼层 |阅读模式
函数名: atoi 功能: 把字符串转换成长整型数 用法: int atoi(const char *nptr); 程序例: #include#includeint main(void) {
int n;
char *str = "12345.67";
n = atoi(str);
printf("string = %s integer = %d\n", str, n);
return 0; }-----------------------------------------------函数名: atof 功能: 把字符串转换成浮点数 用法: double atof(const char *nptr); 程序例: #include#includeint main(void) {
float f;
char *str = "12345.67";
f = atof(str);
printf("string = %s float = %f\n", str, f);
return 0; }
回复

使用道具 举报

千问 | 2008-3-20 23:43:17 | 显示全部楼层
#include #include void main(){ int i = atoi("10"); float f = atof("1.2");}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行