WolfPack 491 Posting Virtuoso Team Colleague

hello all,

Hello :)

what's causing this?

Most probably you have selected a Windows GUI application instead of a Windows Console Application. A console application starts from a main function, and a GUI applications starts from a Winmain function. Because cygwin is a command line tool, and all the settings are done by hand you will not get that error.

WolfPack 491 Posting Virtuoso Team Colleague

Well for that much of requests, I think I/O Completion Ports should be the best method to use.

WolfPack 491 Posting Virtuoso Team Colleague

How many maximum clients do you expect to handle at a given time? All depends on that.

WolfPack 491 Posting Virtuoso Team Colleague

Strange. Where did you download it from? Do you trust it?

WolfPack 491 Posting Virtuoso Team Colleague

Didn't the dll come with some kind of documentation?

WolfPack 491 Posting Virtuoso Team Colleague

Now ~SOS~/Wolfpack is going to say some things to you about shaman's and stuff and close the thread :)

heh heh. You have been following us around haven't you. Usually I do not close such threads (I did before, but I had a change of heart), but rather advice the member to start a new thread, and if it is related to an old thread, provide a link to it. That is the proper way to continue a discussion without cluttering the forum with old threads. Closing the thread will keep the old thread still up among the stack. Only deleting the offending post will take the thread back to where it belongs.

In this case I am not sure what the poster is trying to do. It would have been better for him to PM the OP rather than giving a reply that does not serve any purpose. I mean what is a programming mentorship programme? Programmers dont need mentors to look upto. They have some already. Bill Gates, Linus Torvalds.

By the way, what has shamanism got to do with opening up dead threads. Does a shaman bring the dead back to life? :eek:

WolfPack 491 Posting Virtuoso Team Colleague

Move the class declaration of TicTacToe from the TicTacToe.cpp file to the TicTacToe.h file.
Also in the TicTacToe.cpp file add a

#include "TicTacToe.h"

line.
Delete the

TicTacToe();

line from the TicTacToe.h file also.

WolfPack 491 Posting Virtuoso Team Colleague

For the benifit of the community could you refrain from digging up threads almost 2 years old ? Thanks in advance.
If you have the same problem please create a new thread with your effort upto now. :) If you want you can post a link to this thread from your post, so that we know what you are talking about.

WolfPack 491 Posting Virtuoso Team Colleague

No. I am closing the thread. And it is not a matter for discussion, so do not try to get this thread opened.

WolfPack 491 Posting Virtuoso Team Colleague

Well, then that means you can pause the program when it hits the breakpoint. So I guess this should do. Just google for "Visual C++ Debugging" or something on that lines, and you should get a load of material.

WolfPack 491 Posting Virtuoso Team Colleague

This thread most probably discusses your problem. Go through it and see if it has the solution.

WolfPack 491 Posting Virtuoso Team Colleague

Heh. They would last all right. But they won't be seeing much of each other. :cheesy:

WolfPack 491 Posting Virtuoso Team Colleague

Here is an example from MSDN which I think should help you.

WolfPack 491 Posting Virtuoso Team Colleague

There isn't a portable way of getting it. What operating system are you using?

Edit:
Oops. Forgot to read the heading. You are using windows.

WolfPack 491 Posting Virtuoso Team Colleague

From Tom Lehrer's Bright College Days:

Sliding down the razor blade of life

using balls as brakes.:mrgreen:

WolfPack 491 Posting Virtuoso Team Colleague

Eek- it's post #7,000! My, how the time flies........ :mrgreen:

Apparently horn blowing is infectious. :cheesy:

WolfPack 491 Posting Virtuoso Team Colleague

I've been working on it for hours and have gotten it down to one syntax error

Next time, please give the syntax error. If you had learnt to properly indent your code, you wouldn't have got this error. Here is the corrected code.

#include <iostream>
#include <string>
using namespace std; 
int main()
{ 
    unsigned int board = 511;
    unsigned int mask = 256;
    int i, j;
    int number; 
    do 
    { 
        cout << "Press a number [1-9 or 0 to quit]:";
        cin>> number; 
        switch (number)
        { 
            case 1: 
                board = board ^ 416; // if (input == 1) then (switch 1,2,4) 
                break; 
            case 2: 
                board = board ^ 464; // if (input == 2) then (switch 1,2,3,5)
                break; 
            case 3: 
                board = board ^ 200; // if (input == 3) then (switch 2,3,6)
                break; 
            case 4: 
                board = board ^ 308; // if (input == 4) then (switch 1,4,5,7)
                break; 
            case 5: 
                board = board ^ 186; // if (input == 5) then (switch 2,4,5,6,8)
                break; 
            case 6: 
                board = board ^ 89; // if (input == 6) then (switch 3,5,6,9)
                break; 
            case 7: 
                board = board ^ 38; // if (input == 7) then (switch 4,7,8)
                break; 
            case 8: 
                board = board ^ 39; // if (input == 8) then (switch 4,7,8,9)
                break; 
            case 9: 
                board = board ^ 11; // if (input == 9) then (switch 6,8,9)
                break; 
        } 
        for (i=0; i<3; i++)
        { 
            for (j=0; j<3; j++)
            { 
                if ((board & mask) == 0)
                    cout << "0"; 
                else 
                    cout << "1"; 
                mask = mask >> 1; 
            } 
        }// was missing
    }// was missing
    while (board!=0); 
    // } is extra
    // {  not needed
    if (board == 0)
        cout << "YOU WIN" << endl; 
 
    // } is extra
    cout << endl; 
 
    // } not needed
 
    return 0; 
}
WolfPack 491 Posting Virtuoso Team Colleague

Hard to tell with your limited explaination. There are some things you can do to see if it is really exhausting memory.
You can check the memory pointer to which memory allocated is assigned using malloc or new. use the condition the memory pointer is NULL for malloc or in the case of new, you can use this technique. Most probably you are trying to access a invalid location. Try to use your debugger ( you know how to use it don't you ) and see at what part of your program does this occur.

Another way to determine if memory is really exhausted it by looking at the task manager if you are using windows. if you can see that the memory usage increases upto its maximum limit and fails while you execute the program, that means the memory is exhausted. If not, then you are doing something else wrong.

WolfPack 491 Posting Virtuoso Team Colleague

Yes you are correct. The size of the dialog box depends on the size of the font.

The dialog box that I designed has a template that looks like this:

ABOUTBOX DIALOG DISCARDABLE 32, 32, 180, 100 STYLE DS_MODALFRAME | WS_POPUP 
FONT 8, "MS Sans Serif" 
BEGIN 
         DEFPUSHBUTTON "OK",IDOK,66,80,50,14 
         ICON "ABOUT1",IDC_STATIC,7,7,21,20 
         CTEXT "About1",IDC_STATIC,40,12,100,8 
         CTEXT "About Box Demo Program",IDC_STATIC,7,40,166,8 
         CTEXT "(c) Charles Petzold, 1998",IDC_STATIC,7,52,166,8 
END

The first line gives the dialog box a name (in this case, ABOUTBOX). As is the case for other resources, you can use a number instead. The name is followed by the keywords DIALOG and DISCARDABLE, and four numbers. The first two numbers are the x and y coordinates of the upper left corner of the dialog box, relative to the client area of its parent when the dialog box is invoked by the program. The second two numbers are the width and height of the dialog box.

These coordinates and sizes are not in units of pixels. They are instead based on a special coordinate system used only for dialog box templates. The numbers are based on the size of the font used for the dialog box (in this case, an 8-point MS Sans Serif font): x-coordinates and width are expressed in units of 1/4 of an average character width; y-coordinates and height are expressed in units of 1/8 of the character height. Thus, for this particular dialog box, the upper left corner of the dialog box is 5 characters from the left edge of the …

WolfPack 491 Posting Virtuoso Team Colleague

I beleive you wanted to update the static variable shipPos1 instead of the variable shipPos which I don't see defined anywhere.

mattyd commented: ty +1
WolfPack 491 Posting Virtuoso Team Colleague

The last error was because you have not used the multiplication operator. In C/C++ there is no implicit multiplication. AB is not equal to A * B Replace that line with

Area = sqrt( S*(S-sideA)*(S-sideB)*(S-sideC) );

As for the other errors, if you have included <cmath> there shouldn't be any problem. If you encounter the same problems, post the corrected code again.

WolfPack 491 Posting Virtuoso Team Colleague

You will have to replace parts like

sideA = sqrt( (x2-x1)^2 + (y2-y1)^2 );

to

sideA = sqrt( pow(x2-x1,2) + pow(y2-y1,2 ));

In C++ ^ does not denote power of.

WolfPack 491 Posting Virtuoso Team Colleague

I tried it again this morning with IE7 -- same results. had to reboot my computer again.

Judging from a previous thread that you had issues with some other movie file, I think it is a problem with media player or the codecs. Try VLC Media player portable, it comes with a lot of builtin codecs, and since it is portable you can use it without installing.

WolfPack 491 Posting Virtuoso Team Colleague

What about the answers here?

WolfPack 491 Posting Virtuoso Team Colleague

To disable the loading of Subversion plugin, goto

Plugins -> Manage Plugins -> uncheck Subversion Plugin -> Restart Codeblocks

Done and done.

Yes, I knew that. But somehow it didnt stop me getting some kind of dialog box. I don't usually trouble with software like that when it is an experiment.

PS: When did i mention Code blocks before... I used that term only in the sticky section and just a few posts back. Dont tell me you tried out that thing after seeing my 9.27 post :eek:

Don't recall. Do a search for code vlocksin your posts and you will find it. If it was you that mentioned it that is. :D

WolfPack 491 Posting Virtuoso Team Colleague

Never heard of it. Is is just a fancy Notepad with syntax coloring, or does it actually have options to use your favorite compiler (similar to what Dev-C++ does) ?

Used it a while back after seeing ~sos~ comment about it in a previous post. What impressed me was that you could use a number of compilers simulataneously (gcc, g++, vc2003, vc2002, vc2005), and that it gave a much more educative and intuitive way of setting compiler options, that are not so easy to find for newbies using Visual Studio. But it started giving me a persistant error about some plugin, I think it was SVN, I uninstalled it. Actually it was written in the readme file that the SVN plugin was under development and not to use it, but I tried to and paid the price. :lol:. Couldn't find a way to disable it afterwards.

WolfPack 491 Posting Virtuoso Team Colleague

it should be like this.

void get_boat (int count, char type[10][128], int time[10])
{
}
WolfPack 491 Posting Virtuoso Team Colleague

This closely resembles what I follow for my coding style. Especially helpful are the formatting and names parts.

WolfPack 491 Posting Virtuoso Team Colleague

But this wasnt the case with Mr. Iamthwee's post since he had posted simple text.

So i dont think only the code tags are responsible for this.

He may have posted simple text, but if he quoted a previous reply and that reply had a part, this problem would arise.[code=language] part, this problem would arise.

WolfPack 491 Posting Virtuoso Team Colleague

Hey. Dani. I think it has something to do with

tags within

tags. Because once I delete the '=c' part, the post is displayed.

WolfPack 491 Posting Virtuoso Team Colleague
WolfPack 491 Posting Virtuoso Team Colleague

Is everything working now or are there still problems?

No there are still some problems. I tried undeleting the post before the last in that thread. But I still can't view it. Apparantly if someone else pressed edit and save it can be viewed. I got a similar request from another user about 2 days back, but I thought it was only some glitch that would not occur again. But looks like it did.

WolfPack 491 Posting Virtuoso Team Colleague

But how to use it ?

I think Ryan's reply is fairly explainatory. Couldn't have said it better myself.

WolfPack 491 Posting Virtuoso Team Colleague

yeah. i tried it modifying it myself, and although i could, i couldn't view it. Anyway thanks :D

WolfPack 491 Posting Virtuoso Team Colleague

Why can't I view this post? When I try to edit it, I can see the contents. But not in the page.

WolfPack 491 Posting Virtuoso Team Colleague

You should use pointers. Such as:

// ...
int array[][] = { {1, 12, 9}, {23, 12, 6} };
something(&array);
 
} // end of main
 
void something(int *something) {
// ...
}

That should answer your latest question, as this method is more flexible than the one WolfPack suggested.

Your snippet won't compile.

int array[][] = { {1, 12, 9}, {23, 12, 6} }; // cant declare 2-D arrays like this.
void something(int *something) { // cant pass 2-D arrays like this.
// ...
}
WolfPack 491 Posting Virtuoso Team Colleague

Just go through the link I posted. It has examples for single and 2 dimensional array passing.

WolfPack 491 Posting Virtuoso Team Colleague

:rolleyes: Back to lowly 9th, and it ended today.

But that's ok. Judging by the before and after vote numbers, it looked like the groups ahead of us went on a voting frenzy (like, they picked up 50+ votes) in the past day.

Oh well...


Thanks again everybody for helping, its much appreciated. ;)

Well, to tell the truth I was expecting something like that. But when I voted last night (but I am 13 hours ahead of you lot), you were still at 4th place , so I thought that you couldn't go worse than that.

I once saw the same thing happen in a chat site too. There was this contest to choose the king of chat, and you could only vote once for one IP address. We saw some fellow with a dialup ( in case you have forgotten in this era of broadband, for dialup the IP address usually changes once you disconnect and relogin) who was faily down in the order, get over a 1000 votes in the final day:surprised . Naturally he ended up king. I didnt have a dialup connection, and applied, but when the paperwork was done, it was too late costing me about 15$ for setup, one months charge and diconnection. :mad:

WolfPack 491 Posting Virtuoso Team Colleague

This should serve as a good example. As the arrays are passed by reference, the modifications you make inside the function will be shown even after exiting it. So you can enter the values inside the function and use the contents inside main.

tehloki commented: useful resource +1
WolfPack 491 Posting Virtuoso Team Colleague

SOOOOOOOoooooooooo...... What happened?????

WolfPack 491 Posting Virtuoso Team Colleague

Only when you want to reply to a post which has quoted some other post, the button gets used.

Like:


Now try to multi quote my post and it will happen

Hope it helped, bye.

No. What you are explaining is nested quotes. The explaination below is the correct one.

If it works like those on other forums I have been to, you press the multi-quote button for each post you want to quote then you press the Advanced Reply button and each post which you have multi-quoted (ie each which has the button highlighted) will be automatically quoted in your reply.

It gives you this.

WolfPack 491 Posting Virtuoso Team Colleague

So, what is the difficulty in printing 12 months? For the time being post the code that prints one month.

WolfPack 491 Posting Virtuoso Team Colleague

If you have a new question please create a new thread. If your current thread has been solved please mark it as solved too.


Why can't you try something first yourself? Aren't you ashamed to ask others to do your work for you?

WolfPack 491 Posting Virtuoso Team Colleague

Plus im sure there are syntax errors in there as i cannot find much helpful info on vectors and i'm lost..

See if you can see anything useful here.

Jonezy commented: Replyin quick.. Useful links.. Awesome.. Thanks mate!! +1
WolfPack 491 Posting Virtuoso Team Colleague

Looks like you will be better off using one of the functions given in this page. All the info you need to use those functions are also given there. So nothing to worry about.

WolfPack 491 Posting Virtuoso Team Colleague

std::map doesnt allow duplicate keys.
Another easy way to implement the solution is to use equal_range to get the start and end positions of elements with matching key value, and iterate between them, to locate all the elements.
Also there may be some functions that you can use in the stl::algorithm library.

WolfPack 491 Posting Virtuoso Team Colleague

multimap::find returns only the first match. So calling it twice will not make any difference. You will have to loop through the map and see if the key is equal to the value you are looking for.
Something like this perhaps.

size_t no_of_items = coll.count(1);
    size_t matches_found =0 ;
    IntStringMMap::iterator itr;
    for (itr = coll.begin(); itr != coll.end() && matches_found < no_of_items ; ++itr) 
    {
        if (itr->first == 1) 
        {
            cout << "the find : " << itr->second << endl;
            ++matches_found;
        }
    }
WolfPack 491 Posting Virtuoso Team Colleague
if    (temptype == 'casual')
{ // I think you missed this brace here.
   casual object_name; // Removed the brackets. 
                       // causal object_name() is a function called object_name that returns a causal object. 
                       // You want a instance of class causal.
   thecasuals.add_casual(object_name);
}
//.. rest of the else ifs
WolfPack 491 Posting Virtuoso Team Colleague

What are the problems you are facing when sorting the array?

WolfPack 491 Posting Virtuoso Team Colleague

I don't understand why you are testing how close the value calculated is to 1/q. But anyway, here is a more refined way of writing the source. The algorithm is the same, so any errors are due to that.
Do not use global variables unless absolutely necessary.

#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
double pif(double q);
int terms=0;
int main()
{
    double q=3.1;
    cout << "Pi Value    Terms\n--------------------------\n";
    cout.setf( ios::fixed );
    cout.precision (2);
    cout << pif(q)<< "        ";
    cout << terms << endl;  // Since you are changing the value of terms in the above line, 
                            // do not output it in the same line. The result is undefined.
                            // Use a seperate line to output terms.
                            // But a better way will be to output the value of n in pif()
    return 0;
}
double pif (double approx) // Use meaningful parameter names rather than just p, q, r
{
    long n=0;
    double pi=0.0;
    double error = fabs( pi - approx );
    double tolerance =  1 / approx; // Assuming approx is positive, this is also +ve
//     while (pi<(q-(1.0/q)) && pi>(q+(1.0/q)))// Actually this should be 
                                               // while (pi<(q-(1.0/q)) || pi>(q+(1.0/q))).
                                               // It is the same as | pi -q | > ( 1.0 / q )
                                               // |x| = absolute value of x
    while ( error > tolerance ) 
    {
        n++;
        term++;
        pi = pi + pow( -1, n + 1)/(2 * n - 1 );
        error = fabs( pi - approx); 
    } …