#include<iostream>
class expand
{
public:
expand(unsigned long long num):value(num){}
std::ostream& operator()(std::ostream& out)const;
private:
unsigned long long value;
static const char * const units[20];
static const char * const tens[10];
};
const char * const expand::units[20] = {"zero", "one", "two", "three","four","five","six","seven",
"eight","nine", "ten", "eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen",
"eighteen","nineteen"};
const char * const expand::tens[10] = {"", "ten", "twenty", "thirty","forty","fifty","sixty","seventy",
"eighty","ninety"};
std::ostream &operator<< (std::ostream &out, expand number)
{
return(number(out));
}
std::ostream &expand::operator()(std::ostream &out) const
{
const unsigned long long quintillion=1000000000000000000;
const unsigned long long quadrillion=1000000000000000;
const unsigned long long trillion=1000000000000;
const unsigned long long billion=1000000000;
const unsigned long long million=1000000;
const unsigned long long thousand=1000;
const unsigned long long hundred=100;
const unsigned long long twenty=20;
const unsigned long long ten=10;
unsigned long long multiple=quintillion;
unsigned long long remain;
if(value>=thousand)
{
while(multiple>value&&(multiple!=quintillionmultiple!=quadrillion
multiple!=trillionmultiple!=billionmultiple!=millionmultiple!=thousand))
multiple/=1000;
out<<expand(value/multiple);
switch(multiple)
{
case(quintillion):out<<"-quintillion"; break;
case(quadrillion):out<<"-quadrillion"; break;
case(trillion):out<<"-trillion"; break;
case(billion):out<<"-billion"; break;
case(million):out<<"-million";break;
case(thousand):out<<"-thousand";break;
}
if(remain=value%multiple)
{
if(remain<hundred)
out<<"-and";
out<<"-"<<expand(remain);
}
}
else if(value>=hundred)
{
out<<expand(value/hundred)<<"-hundred";
if(remain=value%hundred)
out<<"-and-"<<expand(remain);
}
else if(value>=twenty)
{
out<<tens[value/ten];
if(remain=value%ten)
out<<"-"<<expand(remain);
}
else
out<<units[value];
return(out);
}
int main()
{
for(unsigned long long ull=0; ull<0xffffffffffffffff; ++ull)
std::cout<<expand(ull)<<std::endl;
return(0);
}
Use inline assembly instructions. Then compile your C++ program to produce the machine code.
C++ is high-level source code, while MIPS is low-level machine code for a reduced instruction set computer (RISC). To convert C++ source code to MIPS you need a C++ compiler specific to the MIPS architecture you're building against.
If you know that the number input will always be three digits: output = 10 * (int)(input / 100) + (input % 10); If you want to idiot proof it (eg. too many digits): output = 10 * (int)((input % 1000) / 100) + (input % 10);
Its code of estonia
Divide it by 1000.
Telephone numbers throughout Russia are uniformly 3 digits for the area code plus 7 digits for the local number.
No such code. +1 is the country code for America The calling code is therefore the three digits beginning with 60 in this case.
The first two digits (49) suggest a number in Germany. HOWEVER - there is no area code starting with the next three digits (414),
the International Freephone Service
200,000 + 10,000 = 210,000
International dialling codes are generally two digits, so you would look at the +66, not the +669. The +66 code is for Thailand.
Computer engineers use to use the hexadecimal code to program computers, or the base 16. Hexadecimal numbers use the digits 0 through 9, plus the letters A through F to represent the digits 10 through 15.
Country code +234 is Nigeria, and +234 80 plus 8 more digits is a mobile number.
You cannot. C++ and shell script (which shell, by the way? there are more than one) are entirely different languages.
+9 is not a ZIP Code. ZIP Codes are postal codes used in the USA. They are uniformly 5 digits, with a 4-digit extension. There are telephone country codes that begin with +9, but you need one or two more digits.
I believe that that is not a valid country code - in others words no country has that code.
Use inline assembly instructions. Then compile your C++ program to produce the machine code.