fork download
  1. #include <iostream>
  2. using namespace std;
  3. void numWord(int,char[]); //Function Declaration
  4.  
  5. //Global Declaration Char Array With Pointer
  6.  
  7. char *one[]={""," one"," two"," three"," four"," five"," six"," seven",
  8.  
  9. "eight"," Nine"," ten"," eleven"," twelve"," thirteen"," fourteen","fifteen"," sixteen"," seventeen"," eighteen"," nineteen"};
  10.  
  11. char *ten[]={" "," "," twenty"," thirty"," forty"," fifty"," sixty","seventy"," eighty"," ninety"};
  12.  
  13. void main()
  14.  
  15. {
  16.  
  17. int n;
  18.  
  19. clrscr();
  20.  
  21. printf("Enter any number less than 1000: \t");
  22.  
  23. scanf("%d",&n);
  24.  
  25.  
  26.  
  27. If(n>999) //Exits is n is more than 999.
  28.  
  29. printf("–invalid.Enter a number less than 1000–\n");
  30.  
  31. else if(n<=0) //Exits If The Value Is Less Than Or Equal To "0".
  32.  
  33. printf("Enter numbers greater than 0\n");
  34.  
  35. else if(n<100) //Prints Two Digit Numbers.
  36.  
  37. numWord((n%100),"");
  38.  
  39. else if(n%100==0) // To Print Hundred Multiples
  40.  
  41. numWord((n/100),"hundred");
  42.  
  43. else
  44.  
  45. {
  46.  
  47. numWord((n/100)," hundred and");
  48.  
  49. numWord((n%100)," ");
  50.  
  51. }
  52.  
  53. }
  54.  
  55. void numWord(int n,char ch[]) //Printing Function
  56.  
  57. {
  58.  
  59. (n>19)?printf("%s %s \n",ten[n/10],one[n%10]):printf("%s ",one[n]);
  60.  
  61. printf("%s ",ch);
  62.  
  63. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
24
compilation info
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:11: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:13: error: ‘::main’ must return ‘int’
prog.cpp: In function ‘int main()’:
prog.cpp:19: error: ‘clrscr’ was not declared in this scope
prog.cpp:27: error: ‘If’ was not declared in this scope
prog.cpp:29: error: expected `;' before ‘printf’
prog.cpp:31: error: ‘else’ without a previous ‘if’
prog.cpp:37: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:41: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:47: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:49: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
stdout
Standard output is empty