CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Threaded View

  1. #1
    Join Date
    Jan 2011
    Location
    Orange County, CA
    Posts
    82

    Unhappy Simple Word Generator Help

    ok, so i havent been programming in a while and am VERY rusty. i can still read code easily, but i cant remember much when i try to write code on my own, soooooo....

    i need to make a program that takes a line of up to 20 letters entered by the user and generate ALL possible outcomes of the scrambled letters (with possible spaces). now, i started the program here:

    Code:
    #include <iostream>
    #include <cstdlib>
    
    using namespace std;
    
    int main()
    {
        while (1)
            {
                char menu_choice[2];
    
                cout << "     ::Menu:: \n\n"
                     << "1. Word Generator\n"
                     << "2. Word Scrambler\n"
                     << "3. Exit Program\n\n"
                     << "Menu Choice: ";
                cin >> menu_choice;
    
                if (menu_choice[0] == '1')
                    {
                       char input[21];
    
                       system ("CLS");
                       cout << "Please enter up to 20 letters and this program will display all\npossible outcomes: ";
                       cin.getline(input,20);
                       system ("PAUSE");
                       system ("CLS");
                    }
    
                else if (menu_choice[0] == '2')
                    {
                       system ("CLS");
                       cout << "Option 2\n\n";
                       system ("PAUSE");
                       system ("CLS");
                    }
    
                else if (menu_choice[0] == '3')
                    {
                        return 0;
                    }
    
                else if (menu_choice[0] != '3')
                    {
                        system ("CLS");
                        cout << "Invalid input.\n\nPress any key to continue...";
                        system ("PAUSE");
                        system ("CLS");
                        continue;
                    }
    
                else
                    {
                        system ("CLS");
                        cout << "Invalid input.\n\nPress any key to continue...";
                        system ("PAUSE");
                        system ("CLS");
                        continue;
                    }
            }
    }
    Any help with the word generator (menu option one) would be grately appreciated (from there i can figure out menu option two), thanks in advance.
    Last edited by iiSoMeGuY 7x; February 21st, 2011 at 08:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured