• 高精度加法


    使用函数库:

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

    源码(加法):

    #include<stdio.h> #include<string.h> #include<stdlib.h> int main(void) { char s1[100],s2[100],s3[100],s4[100],s5[100],s6[100];  //由于是分总程序,请忽略多余 long n=-1,n1=0,n2=0,n3=0,x1,x2,x3,x4,x5,x6,y3,y4; scanf("%s",s5);                      //输入字符串s5 scanf("%s",s6);                      //输入字符串s6

    x5=atol(s5);                     //使用stdlib函数库中atol*(把字符串转换成长整型数)

    x6=atol(s6);                        //将字符串s5、s6转换至long x5 x6 if(x5<0&&x6>=0)                      //设定若x5、x6一正一负下情况 { n3=x5-x6;                         //设定情况下关系式 } else                            //相反正负情况 { n3=x6-x5;                         //关系式 } if(x5>=0&&x6>=0||x5<0&&x6<0)             //设定x5、x6符号相同下情况   { n3=x5+x6;                        //x5、x6符号相同时x5、x6与n3的关系式 } printf("%d",n3); return 0; }

    作者评价:

          由于atol的限制,所以这个程序是“准”,暂时只能得到在“long”类型下的·数据的较高精度加减,并不算一个多好的程序,但由于他为一个整合的程序的一部分,所以实用性较高。请各位客官等待片刻,完整版即将出现在你们的眼前!

    有错请留言评论,新人报道,手嫩,有错请指出。

  • 相关阅读:
    IE10无法打开,需要管理员权限才能打开
    Windows Server 2012 离线安装.NET2.03.5的方法
    Windows Server 2013 安装zune 4.8中文版
    微软发布Visual Studio 2012 Update 2
    禁止视频网站使用Flash P2P上传
    Windows Server 2012 + Firefox + Flash = Crash 崩溃的解决方法
    我的网站,求友情链接
    [zz]ObjectiveC 内存管理精髓
    限时免费抢!正版卡巴斯基安全部队2011激活码1年
    微软Windows 7 SP1 RC 官方已经提供下载
  • 原文地址:https://www.cnblogs.com/ganghan/p/5647813.html
Copyright © 2020-2023  润新知