Linux计算器运算的程序文件

运维 系统运维
bc还可以运行一个Linux计算器带有复杂运算的程序文件(这属于bc的一个扩展属性),

你们知道什么是Linux计算器么这个非常高深的运用技术将由我来非常讲解,Linux计算器NB在哪呢,下面我来进入讲述Linux计算器的无限领域。

19--bc Linux计算器

[root@CentOS4 ~]# bcbc 1.06Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.This is free software with ABSOLUTELY NO WARRANTY.For details type `warranty'. (interrupt) use quit to exit.(interrupt) use quit to exit.quit[root@CentOS4 ~]# Linux计算器在bc上常用的运算符有:+加法-减法*乘法/除法(在没有设置scale精确度时候,自动取整)^指数%求余数(取模)在bc上还可以使用++ 变量-- 变量 变量 ++ 变量 --

[root@CentOS4 ~]# bcbc 1.06Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.This is free software with ABSOLUTELY NO WARRANTY.For details type `warranty'. 1+23234+23/2*326725^315625100%40100%238quit[root@CentOS4 ~]# [root@CentOS4 ~]# bc bc 1.06Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.This is free software with ABSOLUTELY NO WARRANTY.For details type `warranty'. scale=2 /*scale=number*/11/42.7511/33.66quit[root@CentOS4 ~]#
Linux计算器说明:scale=2 是设置小数精确度。/*备注部分*/

bc还可以运行一个Linux计算器带有复杂运算的程序文件(这属于bc的一个扩展属性),如:The following is code that uses the extended features of bc to implement a simpleprogram for calculating checkbook balances. This program is best kept in a file so that it can be used many times  withouthaving to retype it at every use.

Linux计算器使用vi建立一个test运算程序:root@CentOS4 ~]# vi testscale=2print ""nCheck book program!"n"print " Remember,deposits are negative transaction."n"print "Initial balance?";bal=read()bal /= 1print ""n"while (1){"current balance = ";bal"transaction?";trans =read()if(trans == 0) break;bal -= trans bal /= 1}

"test" [New] 14L, 268C written[root@CentOS4 ~]# ls计算结果:[root@CentOS4 ~]# bc "testbc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.This is free software with ABSOLUTELY NO WARRANTY.For details type `warranty'. Check book program!Remember,deposits are negative transaction.Initial balance?560current balance = 560.00transaction?400current balance = 160.00transaction?100current balance = 60.00transaction?0quit[root@CentOS4 ~]#

今天Linux计算器就学到这些,发现很多内容非常的有意思。就近来的学习总结出,要想学好Linux计算器,重要一点是英语要学好。虽然大致的意思能看明白,但很吃力,经常金山词霸来查某一个单词的意思,这样往往浪费了很多的时间在解决单词的意思。

【编辑推荐】

  1. Linux Oracle可以装在WMware虚拟机上
  2. CentOS Linux创建私钥与SSH配置文件
  3. 一些高效的Linux命令行操作
  4. 后门技术和Linux LKM Rootkit详解
  5. Linux下的Memcache安装
责任编辑:佚名 来源: CSDN
相关推荐

2011-09-16 14:13:15

Windows7计算器

2009-06-25 09:25:34

Linux

2010-01-21 11:13:29

Linux桌面计算器

2022-07-11 16:19:22

css属性鸿蒙

2018-05-15 15:05:15

Linux桌面科学计算器

2022-03-10 10:14:11

LinuxKAlgebra图形计算器

2020-10-19 16:40:18

LinuxWindows计算器

2020-09-19 17:44:32

Linux计算器命令

2017-09-05 16:43:47

Electron桌面计算器

2016-12-12 13:41:37

iOS简易加法开发

2022-03-02 15:35:57

UI界面容器组件鸿蒙

2023-08-30 08:04:03

架构前端应用程序

2022-03-10 14:57:35

ArkUIets项目开发鸿蒙

2024-01-31 08:33:06

C++编程计算器

2020-08-21 07:35:12

Linux命令行计算器

2010-08-26 14:00:33

云ROI计算器产品

2015-08-05 09:30:32

C#下拉式计算器

2017-07-18 14:28:04

HTMLCSSJS

2011-09-16 13:12:54

IOS应用绘图科学函数计算器

2012-03-16 20:33:20

iPhone
点赞
收藏

51CTO技术栈公众号