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

Buy??? Why when Visual Basic 10.0 Express is free.

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

line 19: >> "\t" YOu can't do that with input streams. If the fields are separated by tabs and do not contain any spaces then istream will auto skip the tabs. If there are any spaces in the fields then you can't use >> operator, but must use getline(), such as getline(is, purchase.name,'\t'); Also the parameter to that overloaded >> operator needs to be an reference to the salesTran object, like this: istream& operator >> (istream& is, salesTran& purchase)

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

Continue posting and you will eventually find out what they are. Some members (mods, previous mods, and members who have made monetary contributions) can customize the rank title.

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

It would be simpler to use an int as the current index into the array instead of a pointer. When the index value reaches the end of the queue then just reset it back to the beginning.

void enqueue(char *p){
    strcpy(pq->names[(pq->tail)++],p);
    if( pq->tail == &names[QSIZE] )
        pq->tail = &names[0];  
     printf("\n\n\t\t Element Successfully Inserted");
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Sorry to say but that is not a linked list -- its just an array. Linked lists look somethig like this:

typedef struct _tagNode
{
   struct _tagNode* next;
   struct _tagNode* prev; // circular list
   char name[30]; // node data
} NODE;

NODE* head = 0;
NODE* tail = 0;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It would be easier to create the thread outside the class, in main() for example, and then instantiate the c++ class inside the thread function. I don't know how to create a thread in *nix so you will have to figure that one out yourself. But here is the general idea.

class MyClass
{
   // blabla
};

int myThreadFunction(void* parameter)
{
   MyClass c;
   // do things with this class
}

int main()
{
   // create the thread here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
void clrscr()
{
   system("cls");
}

The above is only useful for MS-Windows. If you are using *nix then change "cls" to "clear"

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

>>How am I ever going to figure out the actual algorithm for the functions!!

Just like everyone else does -- use your compiler's debugger and single-step through the program at runtime.

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

Or CreateProcess which is only for MS-Windows

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

line 2: delete conio.h because its non-standard and non-portable.

line 16: void main(){

It's always int main() void main() is non-standard and therefore non-portable.

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

>>i don't know how can i use something like "cut",
There is no such term.

It's pretty easy to get the digits

int x = 123;
int digit;
while(x > 0)
{
   digit = x % 10;
   x /= 10;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to make x1 the base class of x2. Study up on ingerentence. In your example X2 will be unable to access the private variables of X1 -- you will have to make those variables either protected or public.

class X2 : public X1
{
   // blabla
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Set the OFN_NOCHANGEDIR to the Flags item in the OPENFILENAME structure and it will not change the program's current working directory.

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

Instead of dynamically creating text boxes try using a grid control Here's a free one for C# that you might be able to use in CLI/CPP, I don't know because I have never tried it.

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

How did you compile sqlite.c with windows Forms project? VC++ 2010 Express gives me errors that it can not be compiled with CLI/C++.

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

Here is an example program

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

If you want to hide Form1 while Form2 is up then just set its Visible property to false

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

             Form2^ f2 = gcnew Form2;
             this->Visible = false;
             f2->ShowDialog();
             this->Visible = true;

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

I have a project that does something similar and it works ok, except uses Show(), not ShowDialog(). But I changed it to use ShowDialog() and it worked too.

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {

             Form2^ f2 = gcnew Form2;
             f2->Show();

         }
};

>>but I can't get back from Form2 to Form1.

You don't have to do anything special, when Form2 is closed Form1 automatically regains control as if nothing had happened.

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

Many city names consist of more than one word. You need to use getline() not >> to enter the city name, such as getline(cin,pNew->cityName);

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

The first hex value is the value of the this pointer. The next item after -> is the constructor that was called. If you look in each of the constructors you will find the string that was passed to the out() method -- nothing magical here. The last part in parentheses is the value of the struct's value integer.

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

on which line does the error appear?

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

don't pass that char* as a double pointer when all it needs is a single pointer int pop(node **hd, char *new_element) { Then it can easily be acessed new_element[i] = (*hd)->element[i]; If the above doesn't fix the problem then it is in how it's accessing hd pointer.


>>char *x = malloc(sizeof(char)*MAX_LINE_LNGTH + 1);
The use of sizeof(char) here is superfluous. sizeof(char) is guarenteed to always be 1.

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

I would suspect your program contains memory leaks. win32 api functions do not exhibit that type of problem.

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

Most likely it's something else in your prograsm. Comment out the call to GetOpenFileName() then re-run your test to see what happens. My guess is that the program will still display the same behavior.

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

>>rec.state == statecontrol

You can not compare two strings like that. All that is comparing is the address of the two character arrays, not their contents. call strcmp() to compare the two.

Also, I suspect you will have big algorithm problems because of the two while loops that both read the same file. Reading should be done only in one spot, not two.

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

That function needs to be prototyped in McCauleyCurrencyConverterHeader.h

adaniel058 commented: Great help and quick reply. Thanks man +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To accomplish the undo option all you need to do is make a copy of the chessboard before any move is made. After the move then use that copy for the undo option.

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

maybe this

Also, for non-static methods it's customary to use the this pointer instead of class name, such as this->CreatePiece() instead of TwoDBoard::CreatePiece(). this-> isn't really needed either, but some programmers like to use it for clarity.

for (int iCol = 0; iCol < 9; iCol++)
		{
			int iTempPieceID;
			iTempPieceID = arrCurrentLayout[iRow][iCol];
			arrPiecesOnBoard[iRow][iCol] = this->CreatePiece(iTempPieceID, iRow, iCol);
			cout << "TEST" << endl;
			cout << arrPiecesOnBoard[iRow][iCol]->getPrintString() << endl;
		}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You might as well delete line 108 because that line will never get executed (unreachable code)

Just as I suspected -- line 34 dereferences an unallocated pointer.

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

>>a chess game that enables two or more players
Never heard of a chess game played by more than two people (or one person and a computer). There are only two sides in a chess game -- white and black. It would be interesting to find out how three people can play the same game without one of the people just being an observer.

In any event, your probblem is most likely attempting to access uninitialized pointers. Of course no one can tell you for sure because we can't see your monitor. Post the program here so that we can see it.

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

Other than for the pure challenge of doing it, I see no reason to write a web site in c++ since there are other markup languages more suited for the task. I don't write web sites but my guess is that not a single one of them were written in pure C or C++.

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

add << right to the cout statement. I like to split up long lines to make them easier to read without horizontally scrolling the code window. Note that I changed some of the widths you had set, but you can use whatever you want.

If you can you might want to display the column titles using two rows of text instead of one. That will make the columns narrower to fit better on the screen.

cout << setw(11) << left << months[i] << setw(8) << right << avgRain[i] << setw(10) 
              << actRain[i] << setw(8) << total << setw(8) << total2 << endl;
Intrade commented: Absolutely awesome. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Instead of having all those arrays it would be better if you created a structure or class to contain all the data for one line, then create a vector of those classes

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

struct item
{
   char s;
   int x;
   double y;
};
int main()
{

    std::vector<item> items;
    std::string line;
    std::ifstream myfile("textfile.txt");
    while( std::getline(myfile, line) )
    {
        item it;
        std::stringstream str;
        str << line;
        str >> it.s >> it.x >> it.y;
        items.push_back(it);
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You could sort the vector then repeated entries will be easy to find with minimum effort and time. Use an interator if you want to erase duplicates because erase() return the iterator to the next item following the one it erased.

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

You want a code beautifier program.

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

Told you so :)

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

The cast has nothing to do with the problem. Your code is the problem, since you were given foo() and can not change it. You will have to post the exact code if you expect to get any further help from anyone. Afterall, we can't see your computer's monitor.

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

>>PS: is %u Ok for printing out addresses
If you want to see the address in hex instead of decimal use %p

This example will show you how data is stored in memory

#include <iostream>

int main()
{
    int x = 123;
    char buf[sizeof(int)];
    *(int *)buf = x;
    for(int i = 0; i < sizeof(int); i++)
    {
        std::cout << (int)buf[i] << ' ';
    }
    std::cout << '\n';
}
myk45 commented: Thanks +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No, don't work with "my" foo.

Again -- "don't work" means nothing to us. Is that what you tell your auto mechanic when you need your car fixed?

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

I agree with gerard -- if you program doesn't work then the problem is elsewhere.

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

what is foo() trying to do that that string? When you say "it doesn't work", what exactly do you mean by that?

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

>>what is the maximum size length can be?
The maximum value of unsigned int -- see your compiler's limits.h for that value.

If you are reading the text file one line at a time, such as using getline(), then use std::string instead of char* so that you don't have to guess (possibly wrong) about the length of a line.

Jsplinter commented: thank you! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>3. Cross platform (I use OSX, windows, and a linux machine)
That pretty-much limits the IDEs that are available on all three platforms.

IMHO VC++ 2010 is the best IDE for MS-Windows, although Code::Blocks is ok too. Neither of them support multiple languages such as Java etc. But for C and C++ I don't think you will find a better IDE. And the VC++ 2010's debugger can't be beat.

>>2. Some UML capabilities (especially I would love a program that can take source code and turn it into UML diagrams)
That's not the job of a compiler and its IDEs. You can get other program to do that, and it doesn't need to be cross-platform capable.

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

Does that compiler have a limit on the length of a symbol? I recall very very old C compilers had a limit of 6 characters for symbol names (this was in the days before c++).

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

Look at the information just above the Message edit box. It has a link to mark the thread as solved.

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

what errors are you getting?

In matrix_add() function you are trying to use an uninitialized pointer m.mat. It has to be allocated memory before setting the array elements in those loops. Move the two lines m.rows = and m.cols = up above the two loops then allocate memory for m.mat.

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

Since you didn't bother to use code tags I'm not going to bother reading it very well. The problem is most likely using calloc() instead of realloc() to increase or decrease the size of the buffer.

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

By itself it means absolutely nothing. In 16-bit compilers such as Turbo C it is sometimes necessary to hardcode memory addresses, such as the screen on MS-DOS is located at 0x8000 (or something like that). So it might be necessary to cast a pointer to that address char* screen = (void*)0x8000; Such addresses is not possible with 32 and 64 bit compilers.