#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=10000000; ull<100000000; ++ull)
std::cout<<expand(ull)<<std::endl;
return(0);
}
it should not start with _ or digit.
If the character's ASCII value is in the range of the digit characters, then it is a numeric. In ASCII, the range of digits is from '0' to '9' (48 to 57 decimal). Note that character constants such as '0' will implicitly convert to the constant integer 48 (the ASCII code for the character) so there is no need to remember the actual value; the compiler can determine this for us. The following function shows how one might test a character to see if it is a digit or not: bool is_digit (const char c) { return (c>='0' && c<='9'); } The function will return true if the given character is a digit, otherwise it will return false.
#include<stdio.h> int main() { int d,j=1,i,flag=0,count=0,k=0; int b[]; char a[],c; printf("enter the number="); scanf("%s",a); printf("enter the digit="); scanf("%c",&c); printf("the place value of given digit is:"); for(i=0;a[i]!='\0';i++) { if(a[i]==c) { b[k]==a[i]-'0'; b[k]=b[k]=*j; flag=1; count++; k++; } j=j*10; } if(flag==1) { printf("the place value of given digit %c is:",c); for(i=0;i<count;i++) printf("\n%d",b[i]); } else printf("your entered digit is not present in number"); return 0; }
letter -> [a-zA-Z] digit -> [0-9] identifier -> letter|_(letter|digit|_)
'n' can be an identifier, '1' is a digit
The word is "octal", not octane. Take groups of three, from the right:10 100 100 011Now, convert each group to an octal digit (same as a decimal digit:2443The word is "octal", not octane. Take groups of three, from the right:10 100 100 011Now, convert each group to an octal digit (same as a decimal digit:2443The word is "octal", not octane. Take groups of three, from the right:10 100 100 011Now, convert each group to an octal digit (same as a decimal digit:2443The word is "octal", not octane. Take groups of three, from the right:10 100 100 011Now, convert each group to an octal digit (same as a decimal digit:2443
Write a program to convert a 2-digit BCD number into hexadecimal
WRITE A PROGRAM TO CONVERT A 2-DIGIT bcd NUMBER INTO HEXADECIMAL
28X6
The root word for digital is digit.
You can use the Windows calculator to do the conversions. If you want to learn how to do it yourself:To convert binary to decimal, multiply the right-most digit with 1, the second digit (from the right) with 2, the third with 4, etc.To convert to octal, group the bits from the right to the left, in groups of 3. Convert each group to a decimal digit.
x = 100A + 10B + CA = B + 1B = C + 2∴A = C + 3A + B + C = 20∴(C + 3) + (C + 2) + C = 203C = 15C = 5∴ B = 7∴ A = 8The number is 875
Not sure about a 5 digit word, but a 5 character word could be VITAL.
well, i think if you use this you can find out. A = 1-9 ,B = 0-9 , C = 0-9 , D = 0-9 , E = 0-9 for 2digit numbers = A A for 3 digit numbers = A B A for 4 digit numbers = A B B A and so on till you get to for 8 digit numbers = A B C D D C B A for 9 digit numbers = A B C D E D C B A and last for 10 digit number = A B C D E E D C B A this should work...
To find the three-digit numbers where the middle digit is the arithmetic mean of the other two digits, we denote a three-digit number as ( abc ), where ( a, b, c ) are its digits. The condition means ( b = \frac{a + c}{2} ), which implies ( a + c ) must be even. For ( a ) (1-9) and ( c ) (0-9), ( b ) must be an integer and a digit (0-9). The pairs ( (a, c) ) that yield valid integers for ( b ) can be counted, leading to 45 valid combinations for three-digit numbers. Thus, there are 45 such three-digit numbers where the middle digit is the arithmetic mean of the other two.
You can use C++ program to decrypt 3 digit number
In these cases the digit itself, or decimal multiples, seem to have been used.