C++ primer plus 练习10

商店销售商品,计算总销售款,平均售价 商店销售某一商品,商店每天公布统一的折扣(discount)。同时允 许销售人员在销售时灵活掌握售价(price),在此基础上,对一次购10件 以上者,还可以享受9.8折优惠。现已知当天3名销货员的销售情况为: 销货员号(num)销货件数(quantity)销货单价(price) 101 5 23.5 102 ... 阅读详情


10.1

#include
using namespace std;
#include
class Bankaccount
{
 char name[60];
 char accountnumber[30];
 int  deposit;
public:
 Bankaccount ();
 Bankaccount(char *na, char*acnum, int dep);
 void show();
 void depositmoney(int money);
 void withdrawing_money(int money);
 ~Bankaccount(){};
};
Bankaccount::Bankaccount()
{
 strcpy_s(name ,60,"Wrong");
 strcpy_s(accountnumber, 30 ,"00000000");
 deposit = 0;
}
Bankaccount::Bankaccount(char*na, char*acnum, int dep)
{
 strcpy_s(name, strlen(na) + 1, na);
 strcpy_s(accountnumber, strlen(acnum) + 1, acnum);
 deposit = dep;
}

void Bankaccount::show()
{
 cout << "储户名字: " << name << endl;
 cout << "账号: " << accountnumber << endl;
 cout << "存款: " << deposit << "元" << endl;
}
void Bankaccount::depositmoney(int money)
{
 deposit += money;
 cout << "存入: " << money << "元" << endl;
 cout << "现在存款: " << deposit << "元" << endl;
}
void Bankaccount::withdrawing_money(int money)
{
 deposit -= money;
 cout << "取出:" << money << "元" << endl;
 cout << "现在存款: " << deposit << "元" << endl;
}

int main()
{
 cout << "------------------  Show B  ------------------\n";
 Bankaccount b;
 b.show();
 cout << "------------------  Show BC ------------------\n";
 Bankaccount bc("Lily Cheng", "13400000", 3500);
 bc.show();
 bc.depositmoney(2500);
 bc.withdrawing_money(1000);
 return 0;
}

 

10.2

#include
using namespace std;
#include
#include
class Person
{
 static const int  LIMIT = 25;
 string lname;
 char fname[LIMIT];
public:
 Person(){ lname = ""; fname[0] = '\0'; }
 Person(const string &ln, const char *fn = "Heyyou");
 void show()const;
 void FormalShow()const;
};
Person::Person(const string &ln, const char * fn )//不要写成 const char *fn = "Heyyou",重定义
{
 lname = ln;
 strcpy_s(fname, LIMIT, fn);
}
void Person::show()const
{
 cout << fname << ", "<<  lname << endl;
}
void Person::FormalShow()const
{
 cout << lname << ", " << fname << endl;
}
int main()
{
 Person one;
 Person two("Smythecraft");
 Person three("Dimwiddy", "Sam");
 one.show();
 one.FormalShow();
 cout << endl;
 two.show();
 two.FormalShow();
 cout << endl;
    three.show();
three.FormalShow();
 
}

 

10.3

//golf.h
#ifndef GOLF_H_
#define GOLF_H_
const int Len = 40;
class golf
{
 char fullname[Len];
 int handicap;
public:
 golf(const char * name, int hc);
 int setgolf();
 void handicaprewrite( int hc);
 void showgolf()const;
};
#endif


//golf.cpp
#include"golf.h"
#include<iostream>
using namespace std;
#include<cstring>
golf::golf(const char * name, int hc)
{
 strcpy_s(fullname, strlen(name) + 1, name);
 handicap = hc;
}
int golf:: setgolf()
{

 cout << "Enter your name: \n";
 cin.getline(fullname, Len);
 cout << "Enter your handicap: \n";
 cin >> handicap;
 cin.get();
 if (fullname == "")  return 0;
 return 1;
}
void golf::handicaprewrite(int hc)
{
 handicap = hc;
}
void golf:: showgolf()const
{
 cout << "Name : " << fullname << endl;
 cout << "Handicap : " << handicap << endl;
}



//pe9 -1.cpp
#include<iostream>
#include"golf.h"
#include<cstring>
using namespace std;
int main()
{
 golf g("Lily Cheng",25);
 g.showgolf();
 int n = 4;
 for (int i = 0; i < n; i++)
 {
  g.setgolf();
  g.showgolf();
 }
}


10.4

//sale.h
#ifndef SALE_H_
#define SALE_H_
namespace SALES
{
 const int QUARTERS = 4;
 class Sales
 {
  double sales[QUARTERS];
  double average;
  double max;
  double min;
 public:
  ~Sales(){};
  Sales(const double ar[], int n);
  Sales();
  void showSales()const;
 };
}
#endif

//sales.cpp
#include"sale.h"
#include<iostream>
using namespace std;
namespace SALES
{
 Sales::Sales(const double ar[], int n)
 {
  int i;
  double total = 0;
  max = -999;
  min = 999;
  if (n > 4) n = 4;
  for (i = 0; i < n; i++)
  {
   sales[i] = ar[i];
   if (max < sales[i])  max = sales[i];
   if ( min >  sales[i])  min =  sales[i];
   total +=  sales[i];
  }
  if (n < 4)
  {
   for (; i < 4; i++)
     sales[i] = 0;
   if ( min > 0)  min = 0;
   if (max < 0) max = 0;
  }
  average = total / 4;
 }
 Sales::Sales()
 {
  int i;
  double total = 0;
  max = -999;
  min = 999;
  cout << "Sales : \n";
  for (i = 0; i < 4; i++)
  {
   cout << i << " : ";
   cin >>sales[i];
   if (sales[i]> max)
     max =  sales[i];
   if ( sales[i] <  min)
     min =  sales[i];
   total +=  sales[i];
  }
   average = total / 4;

 }
 void Sales::showSales()const
 {
  for (int i = 0; i < 4; i++)
   cout << sales[i] << endl;
  cout << "Average: " << average << endl;
  cout << "Max: " << max << endl;
  cout << "Min: " << min << endl;
 }
}


//main.cpp
#include<iostream>
using namespace std;
#include"sale.h"
int main()
{
 using namespace SALES;
 double ar[4] = { 3.3, 2.2, 1.1, 4.4 };
 double ar2[3] = { 2.2, 3.1, 1.1 };
 Sales s(ar, 4);
 s.showSales();
 Sales s2(ar2, 3);
 s2.showSales();
 Sales ss;
 ss.showSales();
 return 0;
}

10.6

#include<iostream>
using namespace std;
class Move
{
 double x;
 double y;
public:
 Move(double a = 0, double b = 0) :x(a), y(b){};
 void showmove()const;
 Move add(const Move&m)const ;
 void reset(double a = 0, double b = 0){
  x = a; y = b;
 }
};
void Move::showmove()const
{
 cout << "x = " << x << ", ";
 cout << "y = " << y << endl;
}
Move Move::add(const Move&m)const
{
 double xx;
 double yy;
 xx = m.x + x;
 yy = m.y + y;
 Move a(xx, yy);
 a.showmove();
 return a;

}

void main()
{
 Move a(5.5, 6.6);
 a.showmove();
 Move b(3.3, 4.4);
 b.showmove();
 a.add(b);
 a.reset();
 a.showmove();
 return;
}


10.7

#include<iostream>
using namespace std;
#include<cstring>
const int LIMIT = 19;
class Betelgeusean_plorg
{
 char plorg[LIMIT];
 int CI;
public:
 Betelgeusean_plorg(char*name = "PLORGA", int ci = 50);
 void SetCI(int ci);
 void showPlorg()const;
};
Betelgeusean_plorg::Betelgeusean_plorg(char*name, int ci)
{
 strcpy_s(plorg, LIMIT, name);
 CI = ci;
}
void Betelgeusean_plorg::showPlorg()const
{
 cout << "Plorg Name: " << plorg << endl;
 cout << "CI: " << CI << endl;
}
void Betelgeusean_plorg::SetCI(int ci)
{
 CI = ci;
}
int main()
{
 Betelgeusean_plorg p;
 p.showPlorg();
 p.SetCI(55);
 p.showPlorg();
 Betelgeusean_plorg pl("Hey you", 25);
 pl.showPlorg();
 return 0;
}

10.5

//stack.h
#ifndef STACK_H_
#define STACK_H_
struct customer
{
 char fullname[35];
 double payment;
};
typedef customer Item;
class Stack
{
 enum{MAX = 10};
 Item items[MAX];
 int top;
 static double total;
public:

 Stack();
 bool isempty()const;
 bool isfull()const;
 bool push(const Item & item);
 bool pop(Item & item);
};

#endif

//stack.cpp
#include"Stack.h"
#include<iostream>
double Stack::total = 0;//要在cpp里赋值,不能在头文件赋值,会重定义
Stack::Stack()
{
 top = 0;
}
bool Stack::isempty()const
{
 return top == 0;
}
bool Stack::isfull()const
{
 return top == MAX;
}

bool  Stack::push(const Item& item)
{
 if (top < MAX)
 {
  items[top++] = item;
  return true;
 }
 else return false;
}

bool Stack::pop(Item & item)
{
 if (top > 0)
 {
  item = items[--top];
  total += items[top].payment;
  std::cout << "Total: " << total << std::endl;
  return true;
 }
 else return false;
}

//stack.cpp
#include<iostream>
#include<cctype>
#include"Stack.h"
using namespace std;
int main()
{
 Stack st;
 char ch;
 customer po;
 cout << "Please Enter A to add a customer.\n"
  << "P to process a customer , or Q to quit.\n";
 while (cin >> ch && toupper(ch) != 'Q')
 {
  while (cin.get() != '\n')
   continue;
  if (!isalpha(ch))
  {
   cout << "\a";
   continue;
  }
  switch (ch)
  {
  case'A':
  case'a':cout << "Enter a customer's name to add: ";
   cin.getline(po.fullname, 35);
   cout << "Enter his\\her payment: ";
   cin >> po.payment;
   if (st.isfull())
    cout << "stack already full\n";
   else
    st.push(po);
   break;
  case'P':
  case'p':if (st.isempty())
   cout << "stack already empty\n";
    else{
     st.pop(po);
     cout << "customer # name: " << po.fullname << ",  payment: " << po.payment
      << " popped.\n";
    }break;
  }
  cout << "Please Enter A to add a customer.\n"
   << "P to process a customer , or Q to quit.\n";
 }
 cout << "Bye\n";
 return 0;
}

10.8
//List.h 一般模板定义和模板实现不分开,一般在头文件实现,做inline函数
#ifndef LIST_H_
#define LIST_H_
const int LIMIT = 10;
template < typename T>
class List
{
 T list[LIMIT];
 int count;
public:
 List();//创建空列表
 bool listadd(const T & a);
 bool isempty()const;
 bool isfull()const;
 void visit(void(*pf)(T & a));
 void show()const;
};
template<typename T>
void add_one(T &a);//随便一个函数
#endif

//List.cpp
#include<iostream>
#include"List.h"
template <typename T>//必须写出模板类,否则T无效 
List<T>::List()//模板类的定义必须有模板参数,不能只写List::List 
{
 list[0] = '\0';
 count = 0;
}
template<typename T>
bool List<T>::listadd(const T &a)
{
 if (isfull() == 0)
 {
  list[count++] = a;
  return true;
 }
 else return false;
}
template<typename T>
bool List<T>::isempty()const
{
 return count == 0;
}
template<typename T>
bool List<T>::isfull()const
{
 return count == LIMIT;
}
template<typename T>
void List<T>::visit(void(*pf)(T &a))
{
 for (int i = 0; i < count; i++)
  pf(list[i]);
}
template<typename T>
void List<T>::show()const
{
 for (int i = 0; i < count; i++)
  cout << list[i] << " ";
}
template<typename T>
void add_one(T&a)
{
 a = a*a;
}

//list实现.cpp
#include"List.h"
#include"List.cpp"//模板定义和模板实现分开时,需要弄这个
#include<iostream>
using namespace std;
int main()
{
 List<int> list;
 int i;
 cout << "empty? " << list.isempty() << endl;
 for (i = 0; i < 5; i++)
 {
  list.listadd((i+2) );
 }
 list.show();
 cout << endl;
 cout << "full? " << list.isfull() << endl;
 list.visit(add_one);
 list.show();
 return 0;
}

C++程序设计c++.primer.plus第五版第十章编程练习答案 Betelgeusean plorg 有这些特征。 C++程序设计 c++.primer.plus第五版第十章编程练习答案 Betelgeusean plorg 有这些特征。 数据: a. plorg的名称不超过19个字符; b.plorg有满意指数(CI),这是一个整数。 操作: a. 新的plorg将有名称,其CI值为50 b. plorg的CI可以修改 c. plorg可以报告其名称和CI d. plorg的默认名称为“Plorga”... 阅读详情

相关推荐

C++ Primer Plus(第六版)编程练习答案 第10章 对象和类

本章所有编程练习的工程源码可在此处下载(点击此链接下载),供大家参考交流!   1.为复习题5描述的类提供方法定义,并编写一个小程序来演示所有的特性。   复习题5是要求定义一个类来表示银行账户,存储的数据成员包括储户姓名、账号和存款;然后成员函数执行以下操作: 创建一个对象并将其初始化; 显示储户姓名、账号和存款; 存入参数指定的存款; 取出参数指定的款项; 所以首先我们需要创建...

清水河C罗——Leonardo-Liu 6264

C++ Primer Plus (第6版) 中文版 第十章 对象和类 编程练习答案

第十章 编程练习 1.为复习题5描述的类提供方法定义,并编写一个小程序来演示所有的特性。 头文件(类定义): #ifndef Account_H_ #define Account_H_ //#include<iostream> #include<string> using namespace std; class BankAccount { private: string...

Alex_Yichao的博客 506

C++ Primer Plus 第6版 第10章 编程练习答案

1. 定义一个类来表示银行账户,数据成员包括储户姓名、账号(使用字符串)和存款。成员函数执行如下操作: 创建一个对象并将其初始化; 显示储户姓名、账号和存款; 存入参数指定的存款; 取出参数指定的款项。 请提供类声明,并为类提供方法定义,编写一个小程序来演示所有的特性。 注意:默认参数位于函数原型中,而不是函数定义中。 // account.h 银行账户 #ifndef ACCOUNT_H_ #define ACCOUNT_H_ class Account { private: en..

Anna_L的博客 811

【c++程序】继承的几个问题

#include using namespace std; class Animal { private: char name[20]; protected: int age; public: void setName(char *name) { strcpy_s(this->name,name); } void setAge(int age) { this->age=age

平凡的世界 718

STM32G4实战:用CubeMX+Keil五分钟搞定FreeRTOS多任务LED控制(避坑指南)

本文详细介绍了如何在STM32G4系列芯片上使用CubeMX和Keil快速配置FreeRTOS实现多任务LED控制,包括环境准备、时钟配置、任务创建及常见问题解决方案。重点解决了时钟源冲突等高频问题,并提供了优化建议和进阶应用示例,帮助开发者高效完成嵌入式开发任务。

joy55的博客 230

用STM32H7的FMC+AD7606搭建多通道数据采集系统:两种工作模式(查询与FIFO中断)的代码详解与性能对比

本文详细解析了基于STM32H7微控制器和AD7606 ADC芯片的多通道数据采集系统设计,重点对比了查询模式与FIFO中断模式的实现方法与性能差异。通过FMC总线实现高速并行数据采集,系统支持16bit同步采样,最高可达200Ksps/通道。文章提供了完整的代码实现和优化策略,帮助工程师在工业监测等实时性要求高的场景中构建可靠的数据采集方案。

weixin_30599769的博客 496

C++命名空间<转>

熟练掌握C/C++语言,熟悉Windows开发平台,能熟练运用MFC自主编开发出一些应用程序;熟练掌握SQL语句,对数据库有很好的认识,能熟练使用SQL Server2000软件;熟练掌握JAVA语言,熟悉J2ME对手机软件开发一定的基础;深入理解面向对象的思想,并能熟练应用于具体的程序设计开发中;熟悉Unix/Linux下C语言的编程以及常用的命令,熟悉汇编语言;熟悉网络的TCP/IP、UDP等...

weixin_30402343的博客 2925

ESP32实战:破解校园网WPA2-Enterprise认证的完整指南

本文详细介绍了如何使用ESP32开发板破解校园网WPA2-Enterprise认证的完整指南。通过硬件准备、环境搭建、核心代码实现及常见问题排查,帮助开发者解决企业级WiFi连接难题,特别适用于校园网环境下的物联网设备开发。

weixin_29194817的博客 462

【C++】C++ primer plus 编程练习—第10章

【代码】C++ primer plus 编程练习—第10章。

crocodlie的博客 193

使用相对路径设置IAR的Additional include directories 以及 $PROJ_DIR$ 的用法

新建IAR工程时免不了要导入工程用到的头文件,那么导入头文时是用相对路径还是绝对路径呢?当然是相对路径了,因为绝对路径会有弊端,那就是,如果将来更换了工程放置的路径,那么这个相对路径就凉凉了,编译必然报错。所以最好还是用相对路径,那么相对路径怎么用呢? 请看以下 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 版权声明 本博文系广州欧科曼科技有限公司所有,转载请注明出处。 广州欧科曼科技有限公司致力于瑞萨MCU及周边相关产品开发设计。 ema

announced1的博客 5393

【详细图解】华为认证考试报名步骤解析(手把手操作)

华为认证报考流程

yuyeconglong的博客 1万+

C++ Primer Plus(第六版)中文版编程练习答案

57 C++ Primer Plus(第六版)第十六章 编程练习答案1exercise01.cpp2exercise02.cpp3exercise03.cpp4exercise04.cpp5exercise05.cpp6exercise06.cpp7exercise07.cpp8exercise08.cpp9exercise09.cpp10exercise10.cpp 1 exercise01.cpp #include<iostream> #include<string> using

yuandenixin的博客 464

lammps蒙特卡洛MC模拟案例

在lammps中,和MC相关的模拟命令有三个:fix gcmc、fix atom/swap、fix sgcmc。在一个lammps模拟中,mc和md可同时存在,间隔运行,所以设置fix sgcmc命令的同时,可以同时设置系综(nve、nvt或者npt)。lammps官网自带案例中也有一个fix sgcmc的案例,主要模拟FeCu合金的MC建模。sgcmc命令可应用到合金的模拟中,如短程有序模拟。MC运行间隔为100步,最终的浓度比例为0.02,也就是2%的Fe原子交换为Cu原子。大家好,我是小马老师。

lammps_jiayou的博客 1838

c++ Primer Plus (第10章编程练习)

这里写目录标题10.10-110.10-210.10-3 10.10-1 #pragma once //10.10-1.h --BankAccount class interface #ifndef BANK_H_ #define BANK_H_ #include <string> class BankAc { private: std::string name; std::string acc; long double deposit; public: BankAc(std::st

weixin_39883581的博客 375

万字长文解密:SAP Fiori 首屏加载缓慢背后的真相

什么是一个健康理想的 Fiori 首次加载状态?FLP 首页不臃肿,用户默认看见的内容不多但足够用缓存作业按规则运行,冷启动不至于每次都从零开始应用首屏只读必要数据,UI5 资源经过 preload,视图异步加载OData 服务字段克制、分页合理、缓存分层清楚后台 CDS 与 HANA 只为当前屏幕做最必要的工作。只要这些标准同时满足,用户第一次打开 Fiori 页面的体感通常会从明显卡顿变成可接受甚至顺滑。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 563

Linux系统故障排查思路实践教程(上)

本文主要介绍了Linux系统日志分析与常见故障排查的实用方法。首先从系统日志的分类及其涉及的日志文件进行说明;其次详细讲解了忘记用户密码的解决方案;接着对系统无法启动问题,提供了异常断电后修复文件系统、/etc/fstab文件丢失恢复等常见故障的处理方案。最后介绍了文件系统只读错误的排查思路和修复方法,包括磁盘空间检查、文件系统修复等实用技巧。全文提供了大量具体命令和操作流程,为Linux系统维护人员提供了实用的故障处理指南。

提供C#相关开发 、云计算、运维测试、网络安全相关技术分享与服务,有意向可联系。 337

C Primer Plus 编程练习10.1

修改程序清单10.7的rain.c程序,用指针进行指针进行计算(仍然要声明并初始化数组)。 警告62个是由于clang tidy。默认数组元素为double型,声明含隐式转换。

weixin_44500921的博客 295

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

C++ Primer Plus 章节编程题练习 10-13章

double m_y;m_x = a;m_y = b;cout << " ----- 显示" << endl;*/m_x = a;m_y = b;return 0;// 纯虚函数(无实现)override基类class Portprivate:public:return str;

weixin_43528481的博客 832

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

C++ Primer Plus 第10章 课后编程练习 代码

第一题 // 1.头文件 //定义类 bank #ifndef BANK_H_ #define BANK_H_ #include <string> class Bank { private: std::string name; std::string account; double money; public: //创建对象并且初始化,默认构造函数 Bank(); // 默认初始化 Bank(const std::string &

DongZhaoCheng 353

C++primer plus 编程练习10.10

编程练习: 1.定义一个类来表示银行账户。数据成员包括出乎姓名、账号(使用字符串)和存款。成员函数执行如下操作: *创建一个对象并将其初始化; *显示储户姓名、账号和存款; *存入参数指定的存款; *取出参数指定的款项; 编写一个小程序来显示所有的特性。 程序编写如下://文件Bankaccount.h class Bankaccount { private: char

feixiang222teng的博客 1520

《C++ Primer Plus》(第6版)第10章编程练习

《C++ Primer Plus》(第6版)第10章编程练习

ProgramNovice的博客 918

C++ primer plus 练习7.10

#include using namespace std; double fnAdd(double x, double y) {     return x + y; } double fnMultiplication(double x, double y) {     return x*y; } double fnCalculate(double x, doub

guess_who_you_are的专栏 465

C++ primer plus 编程练习16.10

函数只能传结构,不能传指针,传指针的话,vector存的都是一个指针。while (FillReview(temp)) {//指针不行。

qq_52758467的博客 168

C Primer Plus 第6版 第10章 编程练习

2. 开始觉得这个题目有问题 , 就是最后面的那个函数copy_ptrs(target3, source, source + 5); 后来发现题目上说,第3个函数传的参数是             最后一个元素后面的元素的指针!!  好别扭。。 #include&lt;stdio.h&gt; void copy_arr(double target[], double source[...

一只大鸽子的博客 720

《C++ Primer Plus (第6版)》6.10 编程练习

环境:Win8 + C-Free 5.0 1. 编写一个程序,读取键盘输入,直到遇到@符号为止,并回显输入(数字除外),同时将大写字符转换为小写,将小写字符转换为大写(别忘了cctype函数系列)。 (参考程序清单6.8) 2. 编写一个程序,最多将10个donation值读入到一个double数组中(如果您愿意,也可以使用模板类array)。程序遇到非数字输入时将结束输入,...

gracegreat1的专栏 3208

C Primer Plus 编程练习10.2

编写一个程序,初始化一个double数组,然后把数组内容复制到另外两个数组 编写一个程序,初始化一个double数组,然后把数组内容复制到另外两个数组(3个数组都需要在主程序中声明)。制作第一份拷贝的函数使用数组符号。制作第二份拷贝的函数使用指针符号,并使用指针的增量操作。把目标数组名和要复制的元素数目作为参数传递给函数。也就是说,如果给定了下列声明,函数调用应该如下面所示: ...

weixin_44500921的博客 94
上一篇: C++ primer plus 练习9
下一篇: C++ primer plus 练习11
Z__
Z__
博客等级 码龄12年 0粉丝 4原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值