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

Cody: read my previous post

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

You need to add a message pump (see code below) within that loop so that the program can process messages. Same thing as lines 98-103 of the code you just posted.

Another way to do it is to run that loop in anothe thread so that your main program is not blocked while it is running.

MSG msg;
while(GetMessage(&msg, hwnd, 0, 0))
{
    TranslateMessage(&msg);
    DispatchMessage(&msg);

    // do stuff
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what has that have to do with java?

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

I've been looking over the API page trying to figure out how I could do something in c/c++. The example code is confusing to me

header("Location: http://www.daniweb.com/api/oauth?client_id=$client_id&redirect_uri=".urlencode($current_url));

What is $current_uri? I understand how to get client_id. Is $current_url the same as client_secret?

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

Oh, so that's the trick. Thanks

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

When I post a URL such as www.programmersforum.org it would be nice if DaniWeb turned it into a clickable link. I thought it used to do that at one time.

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

Here is one place to start. It's just a socket program that executes an http request and get the return results. I have a similar c++ program to find out if a list lf IP addresses are spammers or not -- www.StopForumSpam.com has such a database.

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

I love this tutorial, shows you lots of things about vb.net, including the solution to this thread. I wound up buying the ebook because it contains a couple more chapters that are not in the free online tutorial.

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

You can use any language you want -- most likely the language you know best. C, C++, VB.NET, C#, all will work. I'm not familiar with java so I don't know about it but most likely you can write it with that too. There's not much to reading barcodes -- just buy a very cheap barcode reader and it will dump the barcode contents into the computer's keyboard buffer just as if you typed them yourself.

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

What do you want to know about those questions? We are not mind readers.

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

One of the best resources for MS-Windows programming examples, tutorials, and free code is found on codeproject.com

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

call Directory.GetFiles() as shown here. But be warned that this will take a long time to search your entire hard drive for the files you want. It would be a lot faster to use an MS Access or other SQL database to keep the links to the files.

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

Movie collection system. Read barcodes from movie dvd, look up the information (actors, description, etc) on the internet, and create a local SQL server (e.g. free MySQL) database of that information. You could do lots of stuff with this such as search for specific movie, produce a list of all movies in the database sorted in any order the user wants, or even play the movie.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
__inline int foo()
{
   cout << "Hello World\n";
   return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No, you didn't ruin my day :) Just mark the thread Solved and everything will be ok.

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

Sounds like you created a windows console program but attempting to compile a Windows win32 api GUI program. win32 api programs have WinMain() instead of main() as in console programs.

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

Code::Blocks comes with several GUI toolkits. Just start a project with one of those.

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

One of the things you need to learn is how to look up the descriptions for functions that you do not understand. google is your best friend for doing that. Example: good for "c++ rand" and you will get this list. Any of the first 6 entries in that list will answer your question for you.

Before calling rand() you need to seed it's random number generator so that rand() will return a different set of numbers each time your program is run. The normal way to do that us by using time() function, which returns the current time in seconds.

#include <cstdlib>
#include <ctime>

int main()
{
    srand( time(0) ); // see random number generator

    int n = rand(); // get a random number

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

We're not going to give you a complete solution, wouldn't want to spoil your fun by learning how to program it yourself. How much C and/or C++ do you already know? Do you know how to make the program chose a number between 1 and 100? Hint: use the mod % operator and rand() random number generator. Get that part working first and post the code you have written.

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

Did you read this article? It contains code to read AD database to verify login credentials.

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

CLI is a set of .NET languages that include C++/CLI, VB.NET, C# and F#, and was originally developed by Microsoft. All those languages access the same set of .NET framework API functions and classes. For a detailed explanation you have to read the previously posted link.

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

remove suffix from each word. Say, first on connecting, then on classes.

You mean change "connecting" to "connect" and "classes" to "class"?

The code you posed makes no sense, some lines are incomplete and other just unreadable. Example: line 13 is incomplete, no compiler would be able to successfully compile that line. line 18 is nearly unreadable -- split it up into individual lines to make the code more readable. Putting everything on one line like that is very bad programming style. Also you need to learn to properly indent the code to make it readable. I hope your teacher didn't teach that programming style. If he did then you need to get a different teacher.

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

My guess would be spam bots too -- programmingforums.org is vBulletin based and gets about 10 new registerations an hour -- 99% of them are spam bots.

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

I don't use it because AFAIK none of my Facebook friends are programmers (well, there is one exception) -- they wouldn't know what the question and DaniWeb is let alone be able to answer any of the questions.

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

Maybe google has some preferences for vBulletin sites

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

I agree -- I don't really like it either, but then it might be helpful for new members.

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

I finally got it to work correctly. I moved InitializeComponent() into a New constructor then added global boolean IsInitialized to prevent the Resize event from doing anything until after the form has been completly initialized. Now the click event for the button works and the top of the tab control stays in place while resizing the form.

Public Class Form1
    Dim TCOffset As Point
    Dim IsResized As Boolean = False

    Public Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TCOffset = TabControl1.Location
        IsResized = True
    End Sub

    Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles MyBase.Resize
        If IsResized = True Then
            TabControl1.Size = New Size(Me.ClientSize.Width, Me.ClientSize.Height - TCOffset.Y)
        End If
    End Sub

    Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
        Dim WebPage As String = Trim(txtAddress.Text)
        Me.WebBrowser1.Navigate(WebPage)

    End Sub


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

calling InitializeComponent() turns off the event handlers for other events such as the click event for buttons, how to reset those event handlers?

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

That's great -- almost what I want. Instead of ResizeEnd just set Resize event handler so that the top of the tab control stays in place while I'm resizing the form. Now to do the same with the other controls on the form.

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

Is there any way to make the size of the tab control expand in both hight and width when the entire window is resized? For example, if I initially set the top of the tab control to be about 1 inch below the top of the window and fill the rest of the window I'd like the top to remain where I put it when the window is resized.

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

Does the grid have a column for each month so that all pay for a year is in one row of the grid?

payID | payYear | Jan | Feb | Mar | ....

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

lines 26-28: you can't put functions that have no return value in cout statements. What do you expect cout to print? It can't print what the function doesn't return.

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

but still and still, i am very very optimistic guy.

Think of it as you would when you use a paper shredder to destroy documents. Once shredded there is no way to replace the document (assuming there are no other duplicate copies). You are just SOL.

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

you can also install operating systems on virtual machines (VMs) AFAIK there is no limit to the number of os you can install that way, but I don't claim to be an expert on that subject.

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

Each compiler has it's own implementation of malloc(), but the ones I've debugged (stepped through the assembly code to find out how it does it) initially has a large block of contiguous memory. malloc() it tries to find a free block that is as close as possible to the amount of memory you requested plus some memory for it's own use such as pointer to the next free block of memory and the size of this memory block. So if you request 8 bytes and the smallest available free block is 16 bytes then malloc() might return a pointer to that 16-byte block of memory. When you call free() the compiler puts a pointer to that block back into the free-memory pool so that it can be given out by malloc() again. Some compilers may try to optimize the free memory pool by combining adjacent blocks of memory, defragment the memory, but tha is not always possible.

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

malloc() returns a block of memory AT LEAST as large as you requested, which means it could be larger.

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

It might depend on the compiler. What compiler and operating system are you using? On 32-bit VS 2012 it produces 12. The difference might be your definition of tick.

#include <stdio.h>

typedef int tick;

typedef struct dataPoint {
    tick * tickData;
    struct dataPoint * previousDataPoint;
    struct dataPoint * nextDataPoint;
} dataPoint;


int main()
{
    printf("sizeof(struct) = %u\n", sizeof(struct dataPoint));
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I saw this one coming as soon as Dani gave members the ability to delete their account.

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

I don't have your compiler but it compiles ok with Visual Studio 2012 after fixing the two static variable problems I mentioned.

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//global constants & vars.
const char EMPTY=' ';
const char x='X';
const char o='O';
const char& X=x;
const char& O=o;
char empty=' ';
char& eRef=empty;

//GetOpposite function-needed in Computer obj.'s GetMove() member function & when assigning each obj. their own m_pieces'
int GetOpposite(const char& aPiece)
{
    if (aPiece==X)
    {
        return O;
    }

    else
    {
        return X;
    }
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Board
{
    friend ostream& operator<< (ostream& os, const Board& aBoard);

public:
    Board();
    bool GameWon(char& charRef);//
    bool GameTied();//
    bool IsFull();//
    int  GetHumanMove(); //Gives column #
    void SetBoard(int& column,const char& character);
    bool MoveAcceptable(int& rAns);//
    void RemoveTopPiece(int& colNum);//
    void ClearBoard();//
    bool GameOver(char& r_PieceThatWon);

private:
    int ConvertX(int* pX);
    int ConvertY(int* pY);
    bool ColumnCheckFull(int& column);//
    char m_Array[7][6];
    int m_Rows;
    int m_Col;
    int m_winComNum;
static    int m_Combinations[57][4];

};



int Board::m_Combinations[57][4]={
        {1,8,15,22},{8,15,22,29},{15,22,29,36},
        {2,9,16,23},{9,16,23,30},{16,23,30,37},
        {3,10,17,24},{10,17,24,31},{17,24,31,38},
        {4,11,18,25},{11,18,25,32},{18,25,32,39},
        {5,12,19,26},{12,19,26,33},{19,26,33,40},
        {6,13,20,27},{13,20,27,34},{20,27,34,41},
        {7,14,21,28},{14,21,28,35},{21,28,35,42}, //finished with vertical combinations (21)

        {1,2,3,4},{2,3,4,5},{3,4,5,6},{4,5,6,7},
        {8,9,10,11},{9,10,11,12},{10,11,12,13},{11,12,13,14},
        {15,16,17,18},{16,17,18,19},{17,18,19,20},{18,19,20,21},
        {22,23,24,25},{23,24,25,26},{24,25,26,27},{25,26,27,28},
        {29,30,31,32},{30,31,32,33},{31,32,33,34},{32,33,34,35},
        {36,37,38,39},{37,38,39,40},{38,39,40,41},{39,40,41,42}, //finished with horizontal combinations(24)

        {4,10,16,22},{5,11,17,23},{11,17,23,29},{6,12,18,24},{12,18,24,30},{18,24,30,36},
        {7,13,19,25},{13,19,25,31},{19,25,31,37},{14,20,26,32},{20,26,32,38},{21,27,33,39}}; //finished with diagonal combinations (12)



bool Board::GameOver(char& r_PieceThatWon)
{
    //check for tie
    if (GameTied())
    {
        return true;
    }

    else if (GameWon(r_PieceThatWon))
    {
        return true;
    }

    else
    {
        return false;
    }
}
Board::Board()
{
    m_Rows=6;
    m_Col=7;
    m_winComNum=57;

    for (int i=0; i<7;++i)
    {
        for (int v=0;v<6;++v)
        {
            m_Array[i][v]=EMPTY;
        }
    }
}


bool Board::GameWon(char& charRef)
{
    //Checks if the game has been won
    //Check possible combinations
    //character reference …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 54-56 -- class member variables can not be initialized like that -- put the initialization inside the constructor.

The same with line 57 -- can't initialize non-static arrays like that either.

Also: static class data objects must also be declared as if they were normal global variables, that is, outside any function or method, something like this If you make the array that is on line 57 static then it can be initialized globally as illustrated in my code below for someVariable. All you have to do is copy all that initialization code into global area of your program, most likely before the class's implemsnetation code.

class MyClass
{
private:
    static int someVariable;
};

int MyClass::someVariable = 0;

int main()
{

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

have you tried any of these suggestions?

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

If the problem is solved then please mark it solved. There is a button for it near the bottom after the last post.

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

Yes, you need to move one line

int main()
{
        char anotherSale = 'x';
    do  // Loop for repeat sales
    {
        double cashDrawer = 500.00;
        int productID = 0;
        int quantity = 0;
        double cashTendered = 0.0;
        double fCash;
        double mReceived = 0.0;
        double price = 0.0;
        double subtotal = 0.0;
        double salesTax = 0.075;
        double total = 0.0;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After the loop you posed finishes you have to finish reading from the file that has not yet reached EOF and writing it's data to the output file. You need to add more code after line 65 to do that.

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

Anyone familiar with this programming language? If so, anyone use it on the job? I just started reading this turorial and find it to be interesting.

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

maybe you didn't do it right

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    do  // Loop for repeat sales
    {
        double cashDrawer = 500.00;
        int productID = 0;
        int quantity = 0;
        double cashTendered = 0.0;
        double fCash;
        double mReceived = 0.0;
        double price = 0.0;
        double subtotal = 0.0;
        double salesTax = 0.075;
        double total = 0.0;
        char anotherSale = 'x';




        do
        {
            cout << "Please enter desired Product ID or -1 to exit: ";                 // Enter the first Product ID for the first sale (-1 to exit)
                                                                                              // Main loop for each sale
            cin >> productID;



            if (productID == -1)
                break;

            cout << "Please enter desired quantity: ";
            cin >> quantity;


            switch (productID)
            {
                case 101:

                    price = 65.00;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 102:

                    price = 12.50;

                    subtotal = price * quantity;

                    break;

                case 103:

                    price = 24.50;

                    subtotal = price * quantity;

                    break;

                case 104:

                    price = 38.75;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 105:

                    price = 17.80;

                    subtotal = ((price * salesTax) + price) * quantity;               // Switch statement to determine the price, and calculate sales tax, if any, for the item.

                    break;

                case 106:

                    price = 16.50;

                    subtotal = price * quantity;

                    break;


                case 107:

                    price = 42.85;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 108:

                    price = 32.99;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 109:

                    price = 28.75;

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

Move lines 20 and 21 (beginning of the first do loop) up to just after line 6 so that all those variables are declared inside the first do loop. That way they will get reset to 0 each time the first do loop is executed.

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

There is the possibility that the OP has overlooked some important instruction(s). He should post the exact text of the assignment.

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

Remember the exclusive men's only clubs? The only one I know of that still exists in the US is the Presidents of US -- not one of them is a woman.