Get Quote
whatsapp
sample banner

228 Downloads

Question

Complete the header file by adding any needed included libraries and directives. You are NOT allowed to modify the content between any pair of curly braces. Make sure that you put in measures to prevent multiple inclusion of the header file.

Answer

include"Number.h" 
#include
#include
#include
#include
#include
Number::Number()
{
 number = 0;
  int_to_EURO();
 int_to_US();
}
Number::Number(int n)
{
  number = n;
  int_to_US();
  int_to_EURO();
}
void Number::int_to_US()
{
  stringstream ss;
  ss.imbue(locale(""));
  ss << fixed << number;
  US = ss.str();
}
void Number::int_to_EURO()
{
  stringstream ss;
 ss.imbue(locale(""));
  ss << fixed << number;
 EURO = ss.str();
 replace(EURO.begin(), EURO.end(), ',', '.');
}
string Number::get_US_style() const
{
  return US;
}
// Returns int as a string in Euro style. string Number::get_EURO_style() const
{
 return EURO;
}
// Returns the int. int Number::get_number() const
{
  return number;
}
// Sets the value of int, US, and EURO.
void Number::set_number(int n)
{
 number = n;
 int_to_US();
 int_to_EURO();
}
Download Full Sample Here
HIRE EXPERT
Email ID *
Subject
Pages
Deadline