jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I know zero about SDL but do you have all of the directories set up properly?
The includes go under the Project/"YourProject"Properties/ConfigurationProperties/C-C++/AdditonalIncludeDirectories

You'll also need to put the libs directories under the Linker/AdditionalLibraryDirectories of that same Config Properties menu (and the names of the libs under the Linker/Input/AdditionalDependencies))

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The arrays are not passed into the functions with the []. I thought I went over that (EDIT: I did put the brackets around the t by mistake in post #2 but nontheless). Abhimanipal is right, I did not notice that before. You need to declare the array in main() and pass it in to all your functions. I wouldn't make it global.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Don't change the datatype of the definition you need to add the double before m_t[] on line 41. Changing it to int will conflict with your prototype and exacerbate the problem. If the arrays are 2D you must specify the second dimension in the prototype and definition, and you can't address the array with m_t(i,j) in C++. I'm not completely confident I know what you mean by priming read but I don't think so.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You are missing the datatype for m_t[] in your function definition. You are passing m[t] into your functions in main() improperly, you do not need the [].
Take a look at line 51 versus other times you have used a 2D array. If you want to keep m_t as 1D you'll have to compute the index based on i,j. If not you'll have to rework your program.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I hadn't scrolled up far enough to get point.h so apologies for asking for you to post it again. Glad you got it working!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

System.Drawing

The ones with the periods are the C# libraries System::Drawing is correct.

Can you post your point.h? If it is an unmanaged class (i.e. is not a ref or value class) you will probably not be able to incorporate the managed code (the .NET Color portion) with the unmanaged class.You can use it freely in Form1.h because Form inherits from System.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

rand() % 2 is especially risky when it comes to getting the same result every time (for reasons I'm not interested in detailing at the moment).

Good to know and noted.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Well, there's just a tiny bit of delay (it improves a little if you set Form2 to load in Form1's constructor). I imagine (but could not even begin to tell you how to approach it) you could use threads to your advantage. Or you could create one form with a barrier down the middle. It depends on your application. Sorry I can't be of more help.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need to implement a ToString() method in your gun class (or any other that you want to display).

You can declare it inline in the public section of the header for your class:

virtual String ^ ToString() override
{
      return name;
}

change name to whatever member of your class represents the label.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Include "Form2.h" (change to the appropriate name in your code). Create a load method for Form1 and put

Form2 ^ form2 = gcnew Form2();
form2->Show();
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think there's some confusion in terminology is all. I believe when the OP said "template main" he literally meant code his instructor had given him to use as a model to follow (not in the sense of generic programming).

Did you get this resolved, OP, after that detour? The key really is making a default constructor (one with no arguments) as that is what is called when you declare Quaterion A; .

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Part of the problem is that if your program makes it through the two while loops without finding a "?" then set is still equal to false so the while loop runs again and again. You may not even want the while loop.

Also, you may want to put in a break statement (to get out of the for loop) after each of the set = true; statements, since you don't want it to run through the second loop if you've found "?" in the first. In the case of the first for loop, you'll need an additional if statement to break from the while loop/skip the second for also.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, you need to

#include <time.h>
and then one time before you call rand() (so e.g., at the top of main) call
srand((unsigned)time(0));

which seeds the random number generator

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So have your routine choose either 0 or 1 (so use rand() % 2) and then select the appropriate number with an if statement. I'm sure there are plenty of other (and better) ways to do it but that's off the top of my head.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

For some reason if you put two spaces after each element instead of one then all the numbers come out. I can't figure that one out... but that means they are all in the array at any rate.

There are some other problems like putting braces after your else statements to make sure that it includes,e.g. lines 100 and 101 in your last full code listing above.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Are you looking to choose a number within that range or are you looking to choose between one of the two numbers given?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
for(int ROWS = 0; ROWS < 6; ROWS++)
{
        for(int COLUMNS = 0; COLUMNS < 4; COLUMNS++)
       {
            inputFile >> ShippingData[ROWS][COLUMNS];
            cout << ShippingData[ROWS][COLUMNS]<<" ";
          //this loop is going for each column in a particular row
         //after each element there is a space
        }
    //we are here after a row has been completed (after we've gone 
    //through all the columns
   cout <<endl;  //or cout <<"\n";
    //so at the end of the row we place a newline character  

}
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you want it in a table put a newline after the inner loop but before the close of the outer loop. It just happens to display that way, it's all in the array in rows/columns.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What have you tried so far?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You are trying to output shippingData on line 87 which will give you the array pointer when you output it. You need to output shippingData[ROWS][COLUMNS] . Output a space after each one so you can see the values separated out (and if you want put a newline outside of the inner loop at the bottom to have it put each row on a new line).

Step back and take it slow. If you're rushing through it you're not thinking it through...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

ShippingData

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Change your array back to float and it works.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Does your file have the labels in it or is it just the numbers?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Take out the while loop on line 85 and move line 84 to 91 (deleting line 91). Your for loop is collecting the data points you do not need a while.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

WTF

Read the comment. He had tacked this onto another thread. It was assessed in that thread and after that it was split off by a moderator.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Did you check if the file is opening properly (you had it in the other version but it's not in this one). I would say if it is opening properly make a little program to test reading in the file by itself.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You never took any input from the file.

replace line 4 (in the second snippet) with inputFile >> numbers[ROWS][COLUMNS];

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Looks like you did it pretty well. I can think of two options, the first would be to report the collision to the user and not file the word.

The second would be, if you have a string holding your word, nothing is stopping you from appending a colliding word onto the end of the word occupying that position and using a space or comma or any other symbol as the delimiter. You would then need to account for this when you are outputting the strings at a given index. I don't know whether this is a good practice or not, but would work for purposes of your assignment.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So this is something you probably want to read in before you get to that stage of the program. Will the file always be in that format?

If so, make a 2D array for it, use a nested for loop and read each element in:

for(i over rows)
     for(j over cols)
           filein >> my2Darray[i][j];

If the file size isn't going to be known at run time we can make some adjustments. Now, when you get a package in that section of your program, use your two data points to determine the correct row and column of your table.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Oh geez. I glazed right over the period. My apologies OP. When you cited the error I thought you meant the .eof part.

Figure out what you need to read in from the file and when (e.g., if the shipping zone is 5 I need the second row, third column or whatever)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I meant for you to stick the double addition; in between the { }. I wrote it out shorthand since you'd already had the right syntax when you had declared it in main.

Take a step back and look things up if you have to (or if they don't seem right).

@ThePMan I was just happy that we got the line numbers lol.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm a rank amateur in terms of databases but overall it looks to me like you are trying to compile MFC code with the express edition which does not come with that feature.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Substitute what I wrote for lines 7-9 in your snippet.

Keep in mind it's only reading into one variable so you'll probably get the last value in the file. If you have more things you want to read in, you'll need to read it into an array. If that's the case, create the array and use the while loop I gave you to read into it, but add in an index value which you increment in the body of the loop.

Edit: and if you want to read the "shippingzone"th value just put a loop counter where your weightcategory variable was:

int zonecount = 0;
while(zonecount < shippingzone && charge >> shippingcharges[weightcategory][0])
{
    zonecount++;
}
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Go back and pop some code tags around your code, use the edit button and either highlight and press the [code] button in the box, or type the following around your code:
[noparse][code] //code goes here [/code][/noparse].
WaltP (faithful moderator) put them around your last post but try to remember them on your own.

My own clarification:

EDIT: I realized it was your enum you were referencing in the menu part, so disregard that.

I meant that to mean disregard the part I had written previously about using the struct before you declared it.

Okay, so -- remove the entire part between namespace and the enum. To declare a struct up there write the [icode] struct yada {};[/icode] bits around it just like you did when you had it in main.

Here's a hint: look how you've written the names in the enum and look at how you wrote the names when you used them.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The variables on 10 and 11 (thanks WaltP!) have no type. I would first bring them into main and give them a type.

I would move the struct you declare up and out of main. It's not incorrect to put it in main but personally I think it keeps it better organized outside. EDIT: I realized it was your enum you were referencing in the menu part, so disregard that.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What are the errors? Find the first one and fix it and many of the later ones will fall away...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Make table a private member of your class. Use a "setter" method that takes in the value, applies the hash function and puts it in the proper cell of the array.
ADs point is valid and important as not all inputs to your hash function will hash uniquely, causing collisions (how can you store 2+ elements at the same index of the array?). Using a vector allows you to hold multiple entries at the same position. That way it expands as necessary and once you need to retrieve something just step through all the members at that particular location.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use your >> statement to drive the loop:

while(weightcategory<7 && charge >>shippingcharges[weightcategory][0]);

(since it's a one line statement put the ; after it, but if there's a body to the while don't put that one in)
That avoids having to use the eof at all, which can cause other problems like reading in the last line twice.
You could even do something like test for the weightcategory before you go into the while and take that part out of the test condition, since weightcategory doesn't change in that loop.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In order to print something using a cout statement your function must return something (a string, int, double, etc). Your print() method is void. Just call your print method on its own without sending it into cout.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Find the coordinates of the center of the screen and add that to your current point. So if the center was at 50,50 and you had a point at 10,10 it would now be at 60,60 in your coordinate system.
I don't know much if anything about the graphics.h system (as it's older than some of the people posting here) but it seems that a majority systems have this upper left corner = (0,0) orientation, the programmer just has to deal with it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Simply pass the array in as matrix each time without any of the brackets. You've already designated that the function is taking an argument that's a matrix with 2 dimensions in the prototype and definition. When it comes to the definition of the function, the array being passed into a function degrades to a pointer. Passing in matrix[][N] gives a pointer to the array that holds each of the rows of the 2D matrix, not the entire thing.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you have it all in one file like that you need the hash.h portion up top, followed by the hash.cpp portion, followed by the main.cpp portion (and take out the hash.cpp/hash.h code you have pasted directly into main). The hash.cpp portion could be after the main program instead if you wanted. It's important that the main function and the definition of the hash methods "know" about the declaration of the class, hence it must go up top.

Otherwise, including hash.h in main.cpp and compiling as a project (since you have Dev) with hash.cpp or at the commandline as g++ hash.cpp main.cpp -o yourfilenamehere should do the trick.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Save the Excel file out as a CSV file and read it in like any other text file (with ifstream, etc.).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It's curious that you named this program the "dowhile" freight cart. I think a few do/while loops will help you here. Wrap one around the meat of your code like from 13 to 50 and have the loop exit if the user selected 2 (you can leave your one if statement in there since if the response is 1 it's going to do all the processing). Then, each time you are re-prompting the user for an invalid response, use a do/while instead of the if statement.

As far as the other problems, do a quick "desk check" of your program by hand and make sure all the groupings are ok for the if statements.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

change it back to theDoctor = myRecord.getpPtr(); and it appears to work just fine. It doesn't need the operator= after all.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You don't need one as a shallow copy is okay. The compiler is complaining because you didn't put the () after myRecord.getpPtr .

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What have you tried so far?

Hint: use the getline function

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

who are you people?

why are you in my head?

.

It's deja vu, but all over again :)

It's nice that you were thinking of us Dani, I just couldn't resist with my prior comment. Maybe next time I will resist. That'll teach ya.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Thank you VernonDozier, I can ensure you that I always try hard myself before asking anything on the forum, the reason being that I want to learn how to program.
Thanks for posting the code, I had a look at it and I don't think I could have done on my own though, because there are still lots of things I don't know, like your directives

#include <ctime>
#include <cmath>

(never seen them before) and like boolean variables just to name some of them.

Thanks also for the clarification on the array, it's better now :)

ctime is the version of the C header time.h meant to be used in C++ code
cmath is that of math.h
(there is cstdlib for stdlib.h, etc., etc.)