Unimportant 18 Junior Poster

Let's say you want Player 1's average of Stat #1 for both games,
This means,
array[0][0][0]
+ array[0][1][0]
/ 2 (games)
= average

Unimportant 18 Junior Poster

You'll want to set a keyboard hook using the Win32 API, to detect when the key combination is pressed.

Here is the MSDN documentation for SetWindowsHookEx

Here is some random tutorial I found about setting a hook, with code examples given.

Unimportant 18 Junior Poster

I don't see a destructor at all.

You can define one this way:
~CObject( ) { delete [] mName; }

Unimportant 18 Junior Poster

Ok, the code you included is correct.

iamthwee commented: -1 for trying to be smart but failing... Been there got the T-shirt by the way -3
deceptikon commented: Admitting you're wrong is hard, kudos. +12
Unimportant 18 Junior Poster

@deceptikon

You may want to read an intro level tutorial to CPP
http://www.learncpp.com/cpp-tutorial/121-pointers-and-references-to-the-base-class-of-derived-objects/

Objects don't actually recreate their function data (it's not included in structure size) when creating multiple objects.
They refer to a static address table of functions, if the compiler thinks the pointer is a base class it will call the base class function.

Unimportant 18 Junior Poster

@deceptikon

You must be high, at run-time the container object won't know which object is a derived type (versus being a base type) unless he defines the type within the class and casts the base class pointer to the derived class pointer.

@tanatos

In your code, everything will be treated as article within Library.
That means if you have,
CArticle *A1 = new CBook(1000);

and you call,
A1->print( );
you'll see the output of:
virtual void print() const = 0;

Unimportant 18 Junior Poster

To answer your broad question broadly,
open the text file,
separate it into lines,
delimit each line by comma

It's a comma and line break separated file.

Unimportant 18 Junior Poster

@deceptikon
Your solution is wrong.
In your solution, when he calls print() it will treat all of the pointers as articles no matter what they are.

Unimportant 18 Junior Poster

addArticle( ... ) will be interpreted in the context of the pointer.
You'll want to cast it first,

// C++11
auto Magazine((CMagazine*)A3);
// C++3
CMagazine * Magazine((CMagazine*)A3);

Before you call the function itself

Magazine->doSometing(  );



// To be quite honest it doesn't really matter what the buffer pointer is
L1.addArticle((void*)Thing); // Some other coders may yell at you if this isn't well documented
Unimportant 18 Junior Poster

Unlike iamthwee, I also enjoy "plain ole sockets", it can be useful to understand in a lot of cases.

I looked through your source and saw no "overt" errors at a glance.
I did wonder, are you sure that static cookie does what you think it does?

If you accept encoded data, that means you're telling the remote apache host it's OK to zip the packet before sending it to you, and you'll know how to unzip and interpret it to save bandwidth.

P.S. It's really helpful to people who want to help you if you can narrow down your problem to under 100 lines of code.

Unimportant 18 Junior Poster

Firstly,
for ( ; letter != '*'; ++count);
for(;;); means, "Forever, do nothing."
This is because for refers to exactly 1 statement [do]
Typically enclosed by brackets, i.e. for(...) { expr };
for( ... ) ; means,
for( ... ) { };
which will invariably terminate immediately if the opening condition is false, or continue forever.

In otherwords, you have a typo in your code.
It's also important [when] you initialize finalPrice.
You always initialize finalPrice while count is 0.
double finalCost = ppl * (count); <-- count is 0 at this moment.

By the way, here was how I wrote your problem for my own compiler after I copied it.

#include <iostream>
using namespace std;
int main()
{
    int count(0);
    cout << "Schioppa_Module4_LabAssignment\r\n";
    cout << "What is your next character? Type '*' to end : \r\n";
    for (char letter=0;letter != '*';)
    {
        letter = std::getchar(  );
        if( letter > 47 && letter < 58 ) ++count;    // [ 0 - 9 ]
        if( letter > 64 && letter < 91 ) ++count;    // [ A - Z ]
        if( letter > 96 && letter < 123 )    ++count;    // [ a - z ]
    }
    cout << "What is the price per letter to pay?\r\n";
    double ppl(0.00);
    cin >> ppl;
    double finalCost( ppl * count );
    cout << "You have "<< count << " letters at $"<< ppl <<" per letter, and your total cost is $" << finalCost << …
Unimportant 18 Junior Poster

@OP
[
Keep your original code. Change (count - 1) to (count)
[1 letter] is [1 many PPL]
Add a predicate [isAlphanumeric] to filter whitespace, etc...
]
@ss125
[
No he may not use trim(), as he may not use string/array [library] functions;
as stated explicity and being the primary topic of the thread at present.
]

Unimportant 18 Junior Poster

So letter is in fact literal, and the cost is per letter of a large banner.

Your first approach was closer to the correct solution, inupt each letter.
Additionally, you could add a predicate ([alphanumeric]) at the time of input.

for(;letter!='*')
{
    cin >> letter;
    if( isAlphanumeric(letter) ) ++count;
}
Unimportant 18 Junior Poster

Call me crazy, but I'm pretty sure you misinterpreted "Do not use any string or array functions"
How can you store a letter (sentence, letter as in formal message) without at least allocating memory for it in some arbitrary place or another?
This tells me that it must be OK to at least have an array of strings to store the sentences.

I'm pretty sure the assignment is suggesting that you may not use std::for_each, std::getline, and etc...

Unimportant 18 Junior Poster
typedef char * (*stringReturn) (); // This is a function taking no arguments and returning string
stringReturn * (*funcArray[256])(); // This is an array of functions returning the above type
DWORD (*funcArray[256])(); // Alternatively, you could cast the function address to unsigned int
// return (DWORD)&stringReturnObject;
Unimportant 18 Junior Poster

Personally, I like the sieve of eratosthenes for most problems requiring evaluation of primes under 100,000,000,000 or so.

It's especially beautiful in its ease of implementation in any language.

Unimportant 18 Junior Poster

Some context please?
I would open a socket on port 80 to the host with winsock.
You could use something like selenium if you're OK with opening the browser.

What are the limitations of your objective?

Unimportant 18 Junior Poster

If the thread is constantly working, you could potentially:
A) Split the thread into multiple worker threads
B) Remove sleep altogether (It's busy anyway)
C) Use event listeners

Unimportant 18 Junior Poster

I thought you had already grasped this form, please reconsider your general pattern.

while(true)
{ // Forever...

  // Check each event flag
    // Really, you should use events
  if( CLICK_EVENT ) { /* ... */ };
  if( MOVE_EVENT ) { /* ... */ };
  // It checks them both without waiting
  // If the condition is met, it'll execute
  // It still continues this function when it has finished

  // Wait for 1ms
  Thread.Sleep(1); // This timer applies equally to all events registered here.
}

If you do this, you will achieve your goal.

What you really want is events, but as they say, "You can lead a horse to water...."

Unimportant 18 Junior Poster

In order to solve this problem, perhaps some light reading about general Python syntax may guide you.

Unimportant 18 Junior Poster

If there are no deals, what's $total_pages?

Unimportant 18 Junior Poster

I found this book to be most excellent.
Design by Evolution

Unimportant 18 Junior Poster

Exactly, good job.
However, I don't see how the message box can be conditional in that case.
Perhaps the auto object accepts function delegates?

Unimportant 18 Junior Poster

Like pritaeas said,
if( ! $total_deals ) die("Query failed.")
or
if( $result = mysql_query("") ) { /* ... */ }

Unimportant 18 Junior Poster

Something like this?

public void backgroundthread()
{
    while (true)
    { // Forever, do...

        if(runsomeCode) { // Check for this necessary condition once per 10ms
            this.Invoke((MethodInvoker)delegate {
              runsomeCode = false; // Disable this one-off condition
              MessageBox.Show("Some code will run here!");
            }
        } // This sleep belongs to the parent loop.
        Thread.Sleep(10); // Wait.
    }
}
Unimportant 18 Junior Poster

Firstly you should pick a problem that requires automation.
The subject is broad, to say the least.

Is the project physical, or purely virtual?
In what way is change required?
Can you map the change logically?
Can you define every factor which may have to be adapted?

Current intelligence models are often modeled based on genetics, the human mind, or emergent patterns in nature. There are more ways, of course.

For example, if you made a system such that a node is defined as having a set of traits.
Each trait (protein) has a behavior pattern.
Behavior patterns aren't limited to only physical inputs and outputs.
A behavior pattern may or may not involve other traits (proteins).
Newer nodes may select from an existing set of traits (this may multiply interactions).
Score each node.

A trait can be as simple as, "evaluate this"
or as complex as, "use trait A which changes trait B by evaluating based on trait C"
or more, depending on how you define your system.

Where you start depends heavily on your goals for the future. =)

Unimportant 18 Junior Poster

The GNU Awk User's Guide
This is a good place to start.

Unimportant 18 Junior Poster

Redefine SWAP this way.
#define SWAP(a,b) float * t=a;a=b;b=t;

I'm not sure how you can pass implicit type to the define pre-processor. If anyone has any idea, I'd love to know.

By the way, you could also perform a XOR swap.

#define SWAP(a,b) a^=b;b^=a;a^=b;
#define SWAPPTRCONT(a,b) *a^=*b;*b^=*a;*a^=*b;
Unimportant 18 Junior Poster

Pintrest for example has abstract height for images.
You can see a solution to the problem in this jQuery plugin Wookmark.

Unimportant 18 Junior Poster

To have abstract height or abstract width, one of the two must be undefined.

Unimportant 18 Junior Poster

For some reason, the compiler seems to think that you have a open parenthesis.
To be honest, it could be from the line before.

I won't pretend to know about DX9, I don't make games.
Perhaps one of the all caps defines you are using is in fact a function.

IDirect3DDevice9::CreateVertexBuffer( ) via MSDN:

HRESULT CreateVertexBuffer(
  [in]           UINT Length,
  [in]           DWORD Usage,
  [in]           DWORD FVF,
  [in]           D3DPOOL Pool,
  [out, retval]  IDirect3DVertexBuffer9 **ppVertexBuffer,
  [in]           HANDLE *pSharedHandle
);

Your code:
g_pd3dDevice->CreateVertexBuffer( 3 * sizeof(CUSTOMVERTEX) , 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL);

Length = 3*sizeof(CUSTOMVERTEX);
Usage = 0;
FVF = D3DFVF_CUSTOMVERTEX;
Pool = D3DPOOL_DEFAULT;
// &g_pVB
pSharedHandle = NULL;

If you were to define these things individually, what would your compiler say?

Unimportant 18 Junior Poster
int threeDim[x][y][z];

Algorithm is a synonym of calculus, it means "method"

Unimportant 18 Junior Poster

You can also traverse the array linearly,

int height(13), width(7);
int matrix[height][width];
for(int i=0;i<height*width;++i)
{
  if( !(i%width) ) printf( "\r\n" );
  printf( "%d ", matrix[ i / width ][ i % width ] );
}
Unimportant 18 Junior Poster

Why is everything based on deque size instead of content?

Unimportant 18 Junior Poster

I'll help you,
start by defining the entire state of the game.

We'll call this
int board[9] = { 0 };
A 3x3 space in two dimensions.
0 - Unknown state
1 - Player 1 claims
2 - Player 2 claims

Next, you want to allow input.
The simplest inputs are [position, player]
There are two players.

void set(int pos, int player) { board[pos] = player; }
Where player is [0-2] and pos [0-8]

Check for a cat's game!

bool catsGame(  )
{ // return false if any tile is unset
  for(int i=0;i<9;++i) if( ! board[i] ) return false;
  return true; // To be fair, you could detect a cat's game many moves ahead
} // I didn't take that higher complexity approach here.

Finally, you want to detect victory conditions.

int victory(  )
{
  // check rows [0, 3, 6] are left sides
  for( int i=0;i<7;i+=3; )
  {
    if( !board[i] ) continue; // Unset.
    if( board[i] == board[i+1] && board[i] == board[i+2] ) return board[i];
  }
  // next, check columns [0, 1, 2]
  for( int i=0;i<2;++i )
  {
    if( !board[i] ) continue;
    if( board[i] == board[i+3] && board[i] == board[i+6] ) return board[i];
  }
  // finally, evaluate diagonals [4] is center
  if( board[4] )
  {
    if( board[0] == board[4] && board[0] == board[8] ) return board[4];
    if( board[2] == board[4] && board[2] == board[6] ) return board[4];
  }
  // No winner detected.
  return 0;
}

You can …

Unimportant 18 Junior Poster

Hey, the error is

vector.empty() doesn't take 1 argument

Unimportant 18 Junior Poster
    .mainWrapper{                <---------------------
    background-color:red;               entirety
    width:630px;            <-----------------------------------
    height:400px;
    }
Unimportant 18 Junior Poster

One and two have fixed width,
which consume the entirety,
so it returns.

Unimportant 18 Junior Poster

This is only a hypothesis, perhaps '' is not a valid input.

Unimportant 18 Junior Poster

$query = "INSERT INTO creditlog ('from','to','amount','type'') VALUES ('$sentFrom','$sentTo','$afterCredits','$type');";

'type'' should be 'type'

Unimportant 18 Junior Poster

First you want to start a session.
session_start();

Unimportant 18 Junior Poster

It helps to boil down linked list to its simplest form,
without answering your homework, here is my example of simplified form

struct Node
{
    int value;
    Node * next;

    Node() : next(NULL), value(0) {  }
    Node(int v) : next(NULL), value(v) {  }
    ~Node() { delete next; }

    // add a value to the end of the list
    void push( int v )
    {
      if( next ) next->push(v);
      else next = new Node(v);
    }

    Node * search( int v )
    { // Create a new list of objects matching v
      Node * return(NULL);
      // this basically means search the value
          // if( v == value ) ... This is different for complex types, though the principle remains

      // if it matches this exact node, instantiate the return node (construct with v)

              // Don't forget that return can (and will often be) NULL
      // if(next&&return) return->next = next->search( v ); ... Recursive search
      // else if(next) return = next->search( v );

      // Don't forget to delete the object this function returns
      // delete on NULL does nothing.
    }
};
Unimportant 18 Junior Poster

You'll need to include the code (or HTML form) which POSTs; a small bit about how you use it would also be helpful.

Unimportant 18 Junior Poster

isset() is a function, which checks to see if some object is set, or not.

|| is a logical OR operator,
In english, you could say, "OR"
if( condition OR condition ) then ...

In this case, !isset($_POST['potatoes'] should be !isset($_POST['potatoes'])
In my haste, I didn't add the closing parenthesis.

Edit: It would behoove you to understand the error messages, most of them are quite simple.

Unimportant 18 Junior Poster

He said,

but I still get an infinite loop when the input for ‘difficulty ‘ is not an integer.

Meaning he intends for the loop to end when difficulty is not an integer.

Unimportant 18 Junior Poster
if( !isset($_POST['potatoes'] || !isset($_POST['id']) ) die ("Invalid POST.");
$potatoes = $_POST['potatoes'];
$id = $_POST['id'];
$res = mysqli->query( "UPDATE `plate1` SET potatoes=$potatoes WHERE id=$id" );
Unimportant 18 Junior Poster

You took me too literally...

$res = $mysqli->query( "UPDATE `plate1` SET potatoes=$_POST['potatoes'] WHERE id=$_POST['id']" );

After it completes, don't expect $res to be a list of affected rows.
You can test $res for truth though,
$mysqli->query( "" ) or die( "reason" );
$res = ...
if( $res == false ) die ( "reason" );

Unimportant 18 Junior Poster

Google produced a perfect answer to your question, though it belongs to another forum...
How to interact with IE through C++

Unimportant 18 Junior Poster

Ok, I understand your approach now. The interactivity component of your objective makes perfect sense.

Unimportant 18 Junior Poster

Well, update doesn't return anything.
So of course you can't translate NOTHING into ROW.

Also, you don't need to wrap your query in parenthesis [ UPDATE table SET value=('value') ] Why not [ SET value='value' ] ???
Plus, it's better if you refer to post with quotes rather than symbol.
$_POST['value'] not $_POST[value]
You aren't necessarily wrong, but I'm fairly certain this behavior is deprecated for all but numeral type.