在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ C++/ std::get_money()函數(shù)
std::put_money()函數(shù)
std::setprecision()函數(shù)
std::get_time()函數(shù)
basic_ios::openmode
basic_ios::basic_ios構(gòu)造函數(shù)
ios::rdstate()函數(shù)
ios::good()函數(shù)
C++ <fstream>
fstream::swap()函數(shù)
ios非運(yùn)算符
ostream運(yùn)算符=
std::resetiosflags()函數(shù)
ios::move()函數(shù)
ios::clear()函數(shù)
std::fpos()函數(shù)
ios::narrow()函數(shù)
fstream::close()函數(shù)
ios::imbue()函數(shù)
basic_ios::setstate
ios_base::fmtflags
C++ <iomanip>
std::setw()函數(shù)
ios_base::failure
C++ <basic_ios>
ios::fill()函數(shù)
ios_base::Init
ios::widen()函數(shù)
ios庫(kù)<ios>
std::setbases()函數(shù)
ios::swap()函數(shù)
ios::set_rdbuf()函數(shù)
std::setiosflags()函數(shù)
std::put_time()函數(shù)
std::get_money()函數(shù)
ios_base::seekdir
ios_base::event_callback()函數(shù)
fstream::rdbuf()函數(shù)
std::setfill()函數(shù)
fstream::isopen()函數(shù)
ios::tie()函數(shù)
ios::copyfmt()函數(shù)
fstream::open()函數(shù)
basic_ios::basic_ios析構(gòu)函數(shù)
ios_event::eof()函數(shù)
io::rdbuf()函數(shù)
ios::exceptions()函數(shù)
ios::init()函數(shù)
ios_base::event()函數(shù)
C++標(biāo)準(zhǔn)庫(kù)教程

std::get_money()函數(shù)

此函數(shù)通過(guò)首先構(gòu)造一個(gè)類型為basic_istream::sentry的對(duì)象(noskipws 設(shè)置為 false)來(lái)訪問(wèn)輸入序列。然后(如果 sentry 對(duì)象是 true),它調(diào)用money_get::get(使用流的所選地區(qū))來(lái)執(zhí)行提取和解析操作,并相應(yīng)地調(diào)整流的內(nèi)部狀態(tài)標(biāo)志。

最后,它在返回之前銷毀 sentry 對(duì)象。

它用于從應(yīng)用程序于輸入流的字符中提取字符,并將它們解釋為貨幣表達(dá)式,存儲(chǔ)為mon的值。

聲明

以下是 std::get_money 函數(shù)的聲明。

參數(shù)

  • mon ? 存儲(chǔ)貨幣值的對(duì)象,moneyT 應(yīng)該是long double或者basic_string的一個(gè)實(shí)例。

  • intl ? true表示國(guó)際化,否則為false。這在內(nèi)部用于實(shí)例化適當(dāng)?shù)亩嘤猛绢悺?/p>

示例

例在下面的例子中說(shuō)明了 get_money 函數(shù)的用法。

#include <iostream>     
#include <iomanip>      

int main () {
   long double price;
   std::cout << "Please, enter the price: ";
   std::cin >> std::get_money(price);

   if (std::cin.fail()) std::cout << "Error reading price/n";
   else std::cout << "The price entered is: " << price << '/n';

   return 0;
}

編譯和運(yùn)行上面的程序,將產(chǎn)生以下結(jié)果 -

Please, enter the price: 100
The price entered is: 100

上一篇:ios_base::failure下一篇:ios_base::seekdir