Clinton Portis 211 Practically a Posting Shark

C++ was invented by Bjarne Stroustrup, a professor at Texas A&M. It evolved from the C language.. and was originally referred to as, "C with Classes." The International Standards Organization now governs the c++ language.

Here is a good interview with Bjarne that will answer a lot of ye' questions. For a more comprehensive list of interviews, click here. Also, be sure to check out The Design and Evolution of C++

Clinton Portis 211 Practically a Posting Shark

*names[2] will only have two elements..


*names[0] and *names[1] ;)

Clinton Portis 211 Practically a Posting Shark

Got anything a little easier? :)

How about this:

#include <windows.h>

#define ID_LIST 1
#define ID_TEXT 2

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/*  Make the class name into a global variable  */
char szClassName[ ] = "ComboBox App";

int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nFunsterStil)

{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default color as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "ComboBox App",       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT, …
Clinton Portis 211 Practically a Posting Shark

why not make your own isspace() function then.. ;)

Clinton Portis 211 Practically a Posting Shark

Haven't seen any of your code.. but here is my guess:

int i=0, word_count=0;

//If no text head been read, exit the function
if(!myText.size())

     return;

//Test to see if there are any non-white spaces
bool flag=FALSE;
while(!Flag && myText.substring(i, 1))
{
     if(!isspace(myText.substring))
 
          flag=TRUE;
     i++;
}

if(flag==FALSE)
{
     cout << "No Text Entered!";
     return;
}

//Perform word count - first word
i=0;
while(myText.substring(i, 1))
{
     
     if(isspace(myText.substring(i, 1)) && !isspace(myText.substring(i+1, 1)))

          word_count++;

     i++;
}

//"First Word" provision
word_count++;

like i said.. haven't seen any of your code.. just throwing something your way to think about :cool:

Clinton Portis 211 Practically a Posting Shark

sounds like you are on the right track.. counting the number of spaces is probably the easiest way to calculate the number of words in a file.. but as you have already identified.. one could run into trouble if there are multiple spaces in between words..

so why not identify the number of situations where there is a space and the next character is not a space...

#include<cctype>

if( isspace(string[i]) && !isspace(string[i+1])

     ++word_count;

the above code is not perfect.. you'll have to make considerations for the first word for example.. but should get ye' on the right track ;)