Clinton Portis 211 Practically a Posting Shark
if (StatsChange == "Strength" or "strength" or "str" or "STR" or "Str")

should be:

if (StatsChange == "Strength" || StatsChange == "strength" || StatsChange== "str" || StatsChange== "STR" ||StatsChange== "Str")

I know, believe me I did the same thing when I first got into boolean logic.. because the way you do it (aside from the incorrect symbology) seems correct at first, and more code efficient. However, please realize that there are specific rules at play here; each expression is handled individually.

If only one variable exists, the boolean test will either return TRUE if not zero, and FALSE if zero. Example:

if(variable)
{
     //code 
}

In this instance, if 'variable' contains any value, it will test TRUE and will enter/execute the contents of the if() structure. Conversely, if 'variable' contains a zero, the boolean expression will test FALSE and will simply skip over the entire if() structure.

So like me, you are probably wondering how to avoid these huge multiple lines of logic. Here is one way I can think of:

string input = {"Strength", "strength", "str", "STR", "Str"};
bool match = FALSE:
int i=0;

do{
     if(StatsChange == input[i])
     {
          match = TRUE;
     }
}while(match == FALSE || i < 5);

Placing boolean tests inside of a loop could potentially eliminate several lines of logical testing.

Clinton Portis 211 Practically a Posting Shark
#include<windows.h>
#include<iostream>
using namespace std;

int main()
{
     char hello[11] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'};

     for(int i=0, i<11, i++)
     {
          cout.put(hello[i]);
          Sleep(500);
     }
return 0;
}
Clinton Portis 211 Practically a Posting Shark

The most popular method of delay is to use the Sleep() function, a member of the <windows.h> library.

Clinton Portis 211 Practically a Posting Shark

Luckily for you, the c++ standard provides you with the tools necessary to open, read, and write to files. You can use these tools by including the <fstream> library. Then you can create ifstream objects that will allow you to open and read from a file, and ofstream objects that will allow you to write to a file.

Here is a pretty decent tutorial for opening, reading and writing to text files using the <fstream> library: http://www.cplusplus.com/doc/tutorial/files/


So, you wish to open a file and examine it's contents in 5 character increments. Since we will not be writing to file, all we will need is a 'ifstream' object.

Probably the easiest method I can think of will involve opening a file, reading its entire contents into a single <string> object, and then performing the desired operations on that string.

I'm not sure what your data will look like, so I will have to make some assumptions with this code, but feel free to modify it as you like.

Here is the pseudo code for what I am about to demonstrate:

1. create an 'ifstream' object (derived from <fstream>)
2. attempt to open an existing .txt file.
3. perform error checking (check to see if file opened correctly)
4. read the entire .txt file into a single 'string' object.
5. perform desired operations on string object (in 5 char increments)
6. close the ifstream object

jbennet commented: good reply +21
Clinton Portis 211 Practically a Posting Shark

I am going through some book assignments.. and I am running into some terminology that doesn't make sense to me..

Impelement this class...

Class Cis Float
Cisfloat a("325.12315");
a+b
a * b


14 (exp # bits)
113 (sigment # bits)

10000........0 bias

what does the author mean by, "exp # bits", "sigment # bits" and "10000.....0 bias..?" I have been programming for a long time and have never ran into this terminology. I am tempted just to disregard these as an attempt to discract the programmer from the main objective as I could implement this class easily without regard to these miscelleneous terms.

please provide clarification if possible/applicable.

-davo

Salem commented: A rare quality question on DW - thanks - salem +6
Clinton Portis 211 Practically a Posting Shark

the only time i can think of using friend functions is for operator overloading.. the rest of the time they should be avoided because they violate OOP data encapsulation.

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, …