#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);
}
const char* DigitToWord (int digit) {
switch (digit) {
case 0: return "zero";
case 1: return "one";
case 2: return "two";
case 3: return "three";
case 4: return "four";
case 5: return "five";
case 6: return "six";
case 7: return "seven";
case 8: return "eight";
case 9: return "nine";
default: return "error";
}
}
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.
it should not start with _ or digit.
#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|_)
NOTE: The program below is written in the form of a straight forwards 'table/look up' chart. It will, quite simply, convert no more than 1 single hex digit character, at a time, into its binary number equivalent. If you wish to convert a whole entire string of hex digit characters together at once; then, I suggest you will need to 'modify' the program yourself by using, possibly, a 'FOR/NEXT loop' statement to extract out each separate hex character which needs to be converted from the users input/together with a function such as, 'MID$()'. ==== Here is a sample program RUN/Output... Please, enter your single character hex digit(0-9/A-F): ? C The binary equivalent of the above hex digit is: 1100
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
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...
You can use C++ program to decrypt 3 digit number
Not sure about a 5 digit word, but a 5 character word could be VITAL.
-7.2 C
To convert deg C to Kelvin, simply add 273.15