Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) line 12: subscripts into arrays must be integers, not doubles. You have one of two choices here: either make the variables i and j integers on line 12 or typecast them to integers every place in your program where they are used as subscripts. Its a lot easier and less error prone to just make them integers on line 12.

2) line 15. The array is declared incorrectly. Should be like this:

char *month[] ={"JANUARY","FEBRUARY","MARCH","APRIL","MAY","JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"};

3) line 85: cout<<(temp[0][ind]); This has a similar problem as that described for line 12 -- variable ind is a double.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

static data objects must also be declared something like global objects

// *.h file
#include <vector>
#include <string>
class foo
{
public:
   static std::vector<std::string> lst;
   // other stuff not shown
};

// *.cpp file
#include "foo.h"
std::vector<std::string> foo::lst;

int main()
{
    return 0;
}

In meantime I found this:
http://homepages.tesco.net/J.deBoyne...functions.html

Only static class methods can be used as thread functions and that link explains why. You already made the method static so don't worry about that part.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

IMO you should not try to integrate the gui into that old DOS code, but rather to write a whole new GUI that includes the features of the old code. First create the gui windows and dialog boxes the way you want them. After you finish that you will probably realize how you can integrate the non-visual features on the DOS program into this new program.

And stop using VC++ 6.0 -- its too old now. Download the free VC++ 2008 Express because its a lot better c++ compiler.

Another alternative is to learn and use C# because its easier to create GUI with C# than it is with C++.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 163 prevents you from making it a pure virtual function. You can't create an object of a class that has a pure virtual function, as you have already found out. So my previous idea to make it pure virtual won't work.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 105 needs the class soping in the name. You can not have just one function for all three classes -- you have to code one method for each class. Three classes, each class declared printtostream() so you must code each of the three methods, one for each class.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

We are just guessing now. Post the code so that we can test see exactly what you have done (you can attach the *.cpp and *.h file(s) to your post)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In the base class the function should be declared a pure virtual function virtual void printtostream(ostream& out) = 0; This will force one (or more) of the derived classes to provide the implementation for that function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you code it like this link ?

c++ classes and their methods are not useable from c. If you want to do that then you will have to create a c++ wrapper that can be called from C.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

static methods can only access static class objects. So if that vector was not declared static then the threads can't access it. This has nothing to do with threads and everything to do with c++ classes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That's the kind of demagoguery that I am supposedly doing.
http://www.factcheck.org/elections-2008/dnc_vs_mccain.html
:cool:

One ad shows selected portions of McCain's comments that a 100-year U.S. presence in Iraq would be "fine with me." The ad uses dramatic images of war and violence, and omits any mention that McCain was speaking of a peaceful presence like that in Japan or Korea.

One difference between Iraq and Korea is that the Koreans have not been at war for the past 5,000 years, and the arabs have. I don't see that the Iraq government nor any of the surrounding nations will let us occupy Iraq for 100 years.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Great games use great game engines such as OpenGL or DirectX. Those do all the really hard work and let you concentrate your efforts on the game, sound and graphics. Yes, you have to be an expert on all those fields. You can't possibly code a good game without being a very good graphics designer, or know someone who is.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hi missy108
Every time I try to view your source code I get RedHat ad.

Not supprised because he didn't post any code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Then you did it wrong. Post your code how you tried it. strand( time(0) ); should appear only once in your program, preferably near the top of main() before any loops or other executable code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Probably the most relaxed coding I've ever done was in a lounge chair at the poolside, sipping a cold drink with one hand while writing code in pencil on paper with the other.

I tried something like that ONCE -- the next day, after the hangover, I had to burn everything I did because it was nothing but a bunch of crap.

Morale: don't drink and code.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb. There are a few regulars here from Austrailia. I always wanted to visit your country, but probably never will.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to Daniweb. You're in luck today because there are quite a few java experts here. All you have to do is post your questions in the Java Software Development board.

jasimp commented: I like that, Daniweg, ;) +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb. I think the place to start is by reading the threads in this Getting Started forum

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

vectors are great for single dimension arrays. As you add more dimensions vectors become much more complicated than simple int arrays like Board. Here's an example of a 2d array of vectors

typedef vector<int> COLUMNS;
vector<COLUMNS> Board;

//or you can do this too
vector< vector<int> > Board;

The nice thing about the above is that the rows do not have to all contain the same number of columns, that is the number of columns can be different for each row.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The solution is to find out what is the difference between clicking on the first column and clicking on the second column. In both cases I think your program should get the click event.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Definition of a nested function:

int main()
{
    // nested function here
    void foo()
    {

    }
}

The above is a nested function because function foo() is defined within function main(). That is not legal.

For legal way to do it see the example in my previous post, which is probably what you intended.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I have a function inside another function that is called by main().
No you don't because nested functions are illegal in C and C++.

The best way to do that is to pass the vector by reference and let the called function populate it. It would be done by passing back a pointer to the vector, be the most efficient and least error prone is to just pass it by reference as shown below.

void foo(vector<string>& ay)
{

}

int main()
{
    vector<string> myArray;
    foo(myArray);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The data type char is simply a one-byte integer. The maximum and minimum values for your machine and compiler are stored in the header file limits.h. Typically the maximum value is 127 and minimum value is -126. An unsigned char data type can store values in the range 0 to 255.

There really is no such thing as a character in C or C++ because the char data type is just a small integer. When you assign the letter 'A' to a char data type you are assigning the integer value that can be found in any ascii chart. For 'A' the decimal equivalent is 65. The only reason you see an 'A' when you display it using cout is because cout uses some complicated processes to transform the number 65 to a printable character. If you have a non-English computer, such as German, French, Chinese, etc the value 65 will be displayed as something else because they do not use standard American ascii tables. It all depends on what fonts are installed on the computer and what language(s) is/are installed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think its about time we add a new MS-Windows board that is specific to MS-Windows programming. Why? Because there have been several threads in the c and c++ boards (probably vb too) that are about windows programming instead of about c or c++. This thread is a good example of that.

It seems to be that it would be a lot easier for members to search for windows programming problems in a windows-specific board instead of wading through the thousands of threads in the c and c++ boards.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To withdraw money you will need to add another method to the Account class

//Definition of the Account class

[class Account
{
public:
    Account( int ); // constructor initializes balance
    void credit( int ); // add an amount to the account balance
    void debit( int ); // subtract an amount to the account balance
    int getBalance(); // return the account balance

    void withdraw(int amount);

private:
     int balance; // data member that stores the balance
}; // end class Account]
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

moved

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Two problems I have with McCain
1) he is too old

2) his assertion that we will continue that war in Iraq for another 100 years!

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It seems to be fixed for me now. Don't know what fixed it unless it was because my computer was rebooted while I was away working today.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
lpBufferA = new CHAR [dwSize];
dwSize = MAX_PATH;

Those two lines are backwards -- dwSize needs to be set before using it in the allocation line.


>> lpBufferA [dwSize] = '\0';
After calling InternedReadFile() the variable dwBytesRead contains the number of characters read, so the above should probably be lpBufferA[dwBytesRead ]= '\0'; >>MultiByteToWideChar (CP_ACP, 0, lpBufferA, -1, lpBufferW, dwSize);
>> WriteFile(hFile, lpBufferW,dwSize, &dwBytesRead, NULL);

Those two functions are also wrong. The dwsize parameter should be dwBytesRead, which is the number of bytes read by InternetReadFile().

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

two problems:
1) ReaderThread must be a static method of the class

2) remove the & &MultiReader::ReaderThread, . Like arrays all you need is the name of the method.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why not just create the array in main() and pass it as a parameter

int CreateBoard(int Board[9][9])
{
   // all your code here
    return 0;
}

int main()
{
    int Board[9][9];
    CreateBoard(Board);   
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> but i would like to know if you could recommned me a site which has a list of all the commnads that I could use

The only site I know of is www.microsoft.com. Just type the name of the function in its search engine and it will locate the explaination in MSDN.

>>but I still have a long way to go to understanding it all.
Don't feel too bad because there is a huge learning curve to know it well -- give yourself 6 months to a year, depending on how fast you learn.

Keep in mind that win32 api is written in C, not c++. There are c++ classes available, such as MFC and wxwindows.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>All the Elements in both the columns are compared first.
do you mean that it compares all the columns in array1[0] with all the columns in array2[0] ? Lets assume there are three solumns in row 0 of each vector, like this:

array1[0][0] = "east tennessee";
array1[0][1]= "west virginia";
array1[0][2]= "north cariolina";

array2[0][0]= "virginia";
array2[0][1]= "cariolina";
array2[0][2]= "georgia";

Its not clear (to me) just what you want to do with all those strings. start with the first column in array2 ("virginia") and try to find it in all the columns of array1 (which would be in array1[0][1]) ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Please post how you declared array1 and array2. Are they std::string objects or std::vector<std::string> objects? Or maybe even something else ?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If the American people want national free heal care, then there is no choice but to raise taxes. Someone has to pay, and it will be the taxpayers. So national health care will be free only to those people who don't pay taxes. Are the taxpayers ready to pay for that because it will cost billions every year.

Of course one solution to that is to stop paying Billions every day for that silly and costly war in Iraq. We finished what we went there for about 5 years ago -- there is no reason for us to stay there any longer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is this still happening for you? I cleared my cache and the site is loading just fine.

That didn't fix it for me. I deleted temporary internet files, exited the browser, restarted and same problem. IE7 on Vista.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

but how would it work so that only specific data is written to a specific variable, such as this. I need to write the First line to name then 2nd line to level and 3rd line to experience and so on. That is why I did it that way.

There are a couple ways. One way is just exactly like I posted before -- data is read in exactly the same order that it was written.

void SaveCharacter()
{
    ofstream data("Character Name.txt");
    data << name << "\n";
    data << level << " " << experience << " " << health << " " << stamina << " " <<
        armor << " " <<abilitypower << " " <<// etc. etc. for all other items
}

Another way is using tagged lines. Its more flexible because you can easily add more items to the file without changing the code very much -- but its more difficult to code.

name="cam9856"
level=25
experience=654321
armor=1
// etc
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's taking a full 45 seconds to finish loading a thread (doesn't happen with menus). After clicking on a thread the first half of the firs posts load almost immediately, then something is waiting 45 seconds (yes I timed it with my watch) before the remainder of the information is loaded and displayed. This occurs consistently on every thread on every board, and I noticed the problem just this morning. Something happened in the past 7 hours.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The code you posted appears to be a rather poor way of designing the file system for saving and restoring character information for your game. Why not just store everything in one file so that the data can be read back using only one file stream ? That entire function could be writtin in just three or four lines of code

void LoadCharacter()
{
    ifstream data("Character Name.txt");
    getline(data, name);
    data >> level >> experience >> health >> stamina >>
        armor >> abilitypower >> // etc. etc. for all other items
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

win32 api function CreateThread(). Its the same for all versions of the compiler. Just look it up in MSDN for parameters -- most parameters can be 0.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

sorry, there is no s on the end #include <algorithm>

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So you have a vector that looks like this ? vector< vector<string> > lst;

vector< vector<string> > lst;
    vector<string> a;
    a.push_back("hello");
    a.push_back("world");
    lst.push_back(a);
    for(size_t i = 0; i < a.size(); i++)
    {
        vector<string>& a = lst[i];
        for(size_t j = 0; j < a.size(); j++)
            transform(a[j].begin(), a[j].end(), a[j].begin(), toupper);
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use the transform function from <algorithms> header file

vector<string> lst;
for(int i = 0; i < lst.size(); ++i)
{
    transform(lst[i].begin(), lst[i].end(), lst[i].begin(), toupper);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
majestic0110 commented: Hehe :) +3
scru commented: now i know what it means! +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Nice program requirements, but what do you want us to do about it? Please don't ask anyone to write it for you because we won't do that. Post what you have tried and ask questions.

Jishnu commented: Exactly... +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

function generate_character() -- here is another example of filling in an instance of a character structure then tossing all that information into the bit bucket without doing anything with it. That make the function completly useless because the values the user enters in that function can not be used anywhere else in the problem. To solve this problem pass an instance of the structure as a parameter into that function void generate_character(character& charman);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I still don't understand what you mean by passing it as a parameter though?
Well, where are the values of that structure supposed to come from? If you hard code the value inside the function then there is no need for all those if statements because the values of the function never change. And that doesn't make sense.

To make that function useful you need to pass the structure into the function as a parameter and the structure must be instantiated in the calling function or somewhere else.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how do v bridge ip add

Huh? I have no idea what you are asking. You need to ask your question on one of the Tech boards

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

> can anyone see the code in which C is written?
Open source compilers like gcc come with source code, so yes. :)

And be prepared to read some very very complex code. Definitely not for beginners. One C function may call several other C functions which are probably in other *.c files. And their implementation changes from one compiler to another. How g++ implements a C function may or may not be anything at all like how Microsoft VC++ implements it or how Borland compilers implement it.

Trying to see how one compiler implements a certain C function may or may not be useful to you unless you are trying to write your own compiler.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I need to do in the dos console.
Forget it then because it can't be done in MS-DOS console program. Requires MS-Windows GUI program.

On second thought I suppose you could create one by using the Microsft win32 api console functions, or using old Turbo C so that you move the cursor to the bottom line of the console window then print the text you want to display.