Thread: Switch statements

  1. #1
    Unregistered
    Guest

    Switch statements

    OK. I need to write a program that converts numeric dates to the actual words. For example, 1/1/01 would print "January First Two Thousand and One". I have do this using a switch statement. I am clueless as to where to start or what to do. Any help would be great.

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    155
    input the string numbers. parse the string of numbers using strtok() or strstream() or your own parsing function or have user input separate numbers for each variable. Then do something like this for each variable you need to convert from symbol to word:

    char ch = '*';
    switch (ch)
    {
    case '+':
    cout << "plus sign' << endl;
    break;
    case '&':
    cout << "ampersand" << endl;
    break;
    case '7':
    cout << "lucky number seven" << endl;
    break;
    //etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using Files Inside Switch Statements
    By arealfind08 in forum C Programming
    Replies: 11
    Last Post: 03-17-2009, 04:49 PM
  2. Switch Statements
    By lazyturtle in forum C++ Programming
    Replies: 12
    Last Post: 05-02-2007, 02:40 AM
  3. Explanation of switch statements
    By ammochck21 in forum C++ Programming
    Replies: 6
    Last Post: 11-04-2006, 02:59 PM
  4. help with switch statements
    By Wexy in forum C Programming
    Replies: 3
    Last Post: 11-06-2002, 05:44 PM
  5. Switch statements for strings
    By cxs00u in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2002, 03:38 PM