0

Ok now its something wrong at 17

#include <iostream>
using namespace std;



const char * vw[] = {"null", "eins", "zwei", "drei", "vier", "f:unf", "sechs", "sieben","acht", "neun", "zehn", "elf", "zw:olf", "dreizen", "vierzehn", "f:unfzehn", "sechzehn""siebsehn", "achtzehn", "neunzehn","zwanzig", "dreiBig", "vierzig", "f:unfzig", "sechzig", "siebzig","achzig", "neunzig" };
 
void PrintNum( int eingabe )
{
    int tens, ones;
 
    if (eingabe>=20)
   {
        tens =eingabe/10;            // tens
        ones=eingabe%10;          // ones
 
        if (y != 0)           // {21..29,31..39, etc.} 
                 printf( "%sund%s", vw[ ones ], vw[ tens + 18 ] );
         else                    // {20,30...80,90} 
                 printf( "%s", vw[ tens + 18 ];  
     }
     else 
     { 
            printf( "%s", vw[ eingabe ] );       // 0...19 
      }
}
void main( void )
{
PrintNum( 78 );
}
0

You missed my post about regetting post #25 as I had been twiddling it over a period of time.

y is ones. y was your old variable!
Also put in the >= 100 and < 0 trap like I also posted.

0
#include<iostream.h>
#include<conio.h>
#include<string.h>

int main()
{
     int eingabe;

     cout<<"Geben sie eine zahl ein> ";
     cin>>eingabe;


     if(eingabe>0 && eingabe<13)
     {
          switch(eingabe)
          {
                case 1:
                     cout<<"eins"<<endl;
                     break;
                case 2:
                     cout<<"zwei"<<endl;
                     break;
                case 3:
                     cout<<"drei"<<endl;
                     break;
                case 4:
                     cout<<"vier"<<endl;
                     break;
                case 5:
                     cout<<"fuenf"<<endl;
                     break;
                case 6:
                     cout<<"sechs"<<endl;
                     break;
                     case 7:
                     cout<<"sieben"<<endl;
                     break;
                case 8:
                     cout<<"acht"<<endl;
                     break;
                case 9:
                     cout<<"neun"<<endl;
                     break;
                case 10:
                     cout<<"zehn"<<endl;
                     break;
                case 11:
                     cout<<"elf"<<endl;
                     break;

          }
     }

     const char *vw[]={"zehn", "drei", "vier", "fuenf", "sech", "sieb", "acht", "neun"};
     const char *xy[]={"einund", "zweiund", "dreiund", "vierund", "fuenfund", "sechsund", "siebenund", "achtund", "neunund"};
     const char *wx[]={"zwanzig", "dreisig", "vierzig", "fuenfzig", "sechzig", "siebzig", "achtzig", "neunzig"};

     int x;
     int y;

     char anf[10];
     char end[10];


          if(eingabe>=13 && eingabe<=19)
          {
                x=eingabe/10;
                y=eingabe%10-1;

                strcpy(anf, vw[y-1]);
                cout<<anf;
          }
}

Edited by Reverend Jim: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.