文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C语言实例65:转换函数

C语言实例65:转换函数

时间:2010-07-04  来源:hnrainll

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    char num1[80], num2[80];
    double sum1;
    int sum2;
    long sum3;

    printf("Enter first: ");
    gets(num1);

    printf("Enter second: ");
    gets(num2);

    sum1 = atof(num1) + atof(num2);
    printf("The sum is : %f\n", sum1);

    printf("Enter three: ");
    gets(num1);
    printf("Enter four: ");
    gets(num2);
    sum2 = atoi(num1) + atoi(num2);
    printf("The sum is: %d\n", sum2);

    printf("Enter five: ");
    gets(num1);
    printf("Enter six: ");
    gets(num2);
    sum3 = atol(num1) + atol(num2);
    printf("The sum is : %ld\n", sum3);

    system("pause");
    return 0;
}


相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载