Help me I can't run this program. What's the problem ?

HELP ME RUN THIS PROGRAM PLEASE. I NEED TO MAKE A DEFENSE ON IT ;(


#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{

long int num;
char choice;

cout<<" NUMBER TO WORDS"<<endl;
START:
cout<<endl;
cout << "Enter a number: ";
cin >> num;
int ones = num%10;
int tens = num/10;
int hundredths = num/100%10;
int thousandths = num/1000%10;

if ((num>=1) && (num<=19))
switch (ones)
{
case 1: cout<<"One";
break;
case 2: cout<<"Two";
break;
case 3: cout<<"Three";
break;
case 4: cout<<"Four";
break;
case 5: cout<<"Five";
break;
case 6: cout<<"Six";
break;
case 7: cout<<"Seven";
break;
case 8: cout<<"Eight";
break;
case 9: cout<<"Nine";
break;
}
switch (tens)
{
case 10: cout<<"Ten";
break;
case 11: cout<<"Eleven";
break;
case 12: cout<<"Twelve";
break;
case 13: cout<<"Thirteen";
break;
case 14: cout<<"Fourteen";
break;
case 15: cout<<"Fifteen";
break;
case 16: cout<<"Sixteen";
break;
case 17: cout<<"Seventeen";
break;
case 18: cout<<"Eighteen";
break;
case 19: cout<<"Nineteen";
break;
default:


if((num>=20) && (num<=99))
switch (tens)
{
case 2:cout << " Twenty ";
break;
case 3:cout << " Thirty ";
break;
case 4:cout << " Forty ";
break;
case 5:cout << " Fifty ";
break;
case 6:cout << " Sixty ";
break;
case 7:cout << " Seventy ";
break;
case 8:cout << " Eighty ";
break;
case 9:cout << " Ninety ";
break;
default:

switch (ones)
{
case 0:cout << " ";
break;
case 1:cout << "One";
break;
case 2:cout << "Two";
break;
case 3:cout << "Three";
break;
case 4:cout << "Four";
break;
case 5:cout << "Five";
break;
case 6:cout << "Six";
break;
case 7:cout << "Seven";
break;
case 8:cout << "Eight";
break;
case 9:cout << "Nine";
break;
default:



if ((num>=100) && (num<=999))
switch (hundredths)
{
case 1:cout << "One Hundred";
break;
case 2:cout << "Two Hundred";
break;
case 3:cout << "Three Hundred";
break;
case 4:cout << "Four Hundred";
break;
case 5:cout << "Five Hundred";
break;
case 6:cout << "Six Hundred";
break;
case 7:cout << "Seven Hundred";
break;
case 8:cout << "Eight Hundred";
break;
case 9:cout << "Nine Hundred";
break;
default:

switch (tens)
{
case 2:cout << " Twenty ";
break;
case 3:cout << " Thirty ";
break;
case 4:cout << " Forty ";
break;
case 5:cout << " Fifty ";
break;
case 6:cout << " Sixty ";
break;
case 7:cout << " Seventy ";
break;
case 8:cout << " Eighty ";
break;
case 9:cout << " Ninety ";
break;
default:

switch (ones)
{
case 0:cout << " ";
break;
case 1:cout << "One";
break;
case 2:cout << "Two";
break;
case 3:cout << "Three";
break;
case 4:cout << "Four";
break;
case 5:cout << "Five";
break;
case 6:cout << "Six";
break;
case 7:cout << "Seven";
break;
case 8:cout << "Eight";
break;
case 9:cout << "Nine";
break;
default:


if ((num>=1000) && (num<=3999))
switch (thousandths)
{
case 1:cout << "One Thousand";
break;
case 2:cout << "Two Thousand";
break;
case 3:cout << "Three Thousand";
break;
default:

switch (hundredths)
{
case 1:cout << "One Hundred";
break;
case 2:cout << "Two Hundred";
break;
case 3:cout << "Three Hundred";
break;
case 4:cout << "Four Hundred";
break;
case 5:cout << "Five Hundred";
break;
case 6:cout << "Six Hundred";
break;
case 7:cout << "Seven Hundred";
break;
case 8:cout << "Eight Hundred";
break;
case 9:cout << "Nine Hundred";
break;
default:

switch (tens)
{
case 2:cout << " Twenty ";
break;
case 3:cout << " Thirty ";
break;
case 4:cout << " Forty ";
break;
case 5:cout << " Fifty ";
break;
case 6:cout << " Sixty ";
break;
case 7:cout << " Seventy ";
break;
case 8:cout << " Eighty ";
break;
case 9:cout << " Ninety ";
break;
default:

switch (ones)
{
case 0:cout << " ";
break;
case 1:cout << "One";
break;
case 2:cout << "Two";
break;
case 3:cout << "Three";
break;
case 4:cout << "Four";
break;
case 5:cout << "Five";
break;
case 6:cout << "Six";
break;
case 7:cout << "Seven";
break;
case 8:cout << "Eight";
break;
case 9:cout << "Nine";
break;
default:


{
num= num+num;
cout<<num;
}
cout<<"Do you want to try again? ";
cin>>choice;
if(choice=='Y' || choice=='y')
{
goto START;
}
else if (choice=='N' || choice=='n')
{
cout<<endl;
cout<<"- End of Program -"<<endl;
}
else
{
cout<<endl;
cout<<"INVALID CODE USED"<<endl;
}

system("Pause");
return 0;
}
Try this out:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <map>

int main()
{
    std::map<int, std::string> dictionary;

    dictionary.emplace(1, "one");
    dictionary.emplace(2, "two");
    dictionary.emplace(3, "three");
    dictionary.emplace(4, "four");
    dictionary.emplace(5, "five");
    dictionary.emplace(6, "six");
    dictionary.emplace(7, "seven");
    dictionary.emplace(8, "eight");
    dictionary.emplace(9, "nine");
    dictionary.emplace(10, "ten");
    dictionary.emplace(11, "eleven");
    dictionary.emplace(12, "twelve");
    dictionary.emplace(13, "thirteen");
    dictionary.emplace(14, "fourteen");
    dictionary.emplace(15, "fifteen");
    dictionary.emplace(16, "sixteen");
    dictionary.emplace(17, "seventeen");
    dictionary.emplace(18, "eighteen");
    dictionary.emplace(19, "nineteen");    
    dictionary.emplace(20, "twenty");
    dictionary.emplace(30, "thirty");
    dictionary.emplace(40, "forty");
    dictionary.emplace(50, "fifty");
    dictionary.emplace(60, "sixty");
    dictionary.emplace(70, "seventy");
    dictionary.emplace(80, "eighty");
    dictionary.emplace(90, "ninety");

    std::cout << "Enter a number: ";
    int number;
    std::cin >> number;

    if (number < 20)
    {
        std::cout << dictionary[number];
    }
    else if (number < 100)
    {
        std::cout << dictionary[number / 10 * 10] << ' ' << dictionary[number % 10];
    }

    return 0;
}
Topic archived. No new replies allowed.