death_oclock 103 Posting Whiz

Your original code is almost right. Just take a look at your structure definition. You want comments to hold a string, but you have defined it as a single character. That's why you're getting an error with gets.

Now, gets won't allocate the variable for you so you'll need to use malloc for comments too. Or you could define it statically like in your second example.

If the user inputs more data than comments can hold, you'll get undefined (and probably unwanted) behavior, so use fgets(currentC->comments, size, stdin); where size is the number of bytes you've allocated for comments .

death_oclock 103 Posting Whiz

There is a single arithmetic operation you can use to convert the ranges 0-89, 90-179, 180-269, 270-359 into the values 0, 1, 2, 3, respectively. The result represents the quadrant; 0 would be the first quadrant.

death_oclock 103 Posting Whiz

You already did. Declaration: int **x_transpose; Initialization: x_transpose= transpose(array,nrows,ncolumns);

death_oclock 103 Posting Whiz

Where are you initializing vowelCount? Anyway, you could just reuse the vowelNum method and do something like this: return word.length() - vowelNum();

death_oclock 103 Posting Whiz

I would honestly like to know why PlottingPanel would have no idea it has been pressed.

Because PlottingWindow implements MouseListener and PlottingPanel does not. PlottingPanel will not receive the MouseEvent.

death_oclock 103 Posting Whiz

Akill10: I think the reason he defined setStartX in PlottingPanel is so that the data would only be sent after a mouse click. With your solution, PlottingPanel has no idea if the mouse has been clicked yet, and therefore startX would likely be zero (or undefined or something).

death_oclock 103 Posting Whiz

This program uses many outdated practices (void main, clrscr, kbhit) and should not be used as an example by anyone.

WaltP commented: So true... +15
death_oclock 103 Posting Whiz

You don't need to allocate memory for x_transpose. After the line x_transpose= transpose(array,nrows,ncolumns); x_transpose points to the same block of memory that was allocated for y. You do need to free all of this memory before the program closes, however.

death_oclock 103 Posting Whiz

Based on what you already wrote, you know how to pass in parameters and call methods. You should be able to figure this one out.

death_oclock 103 Posting Whiz

JPanel doesn't know the value of startX yet, so you can't pass that value in as a parameter. Instead, you should pass in the JFrame object and call the getStartX method inside of setStartX.

death_oclock 103 Posting Whiz

startX and startY should be private or protected.

public int getStartX()
{
	return startX;
}

I trust you can write the method for startY on your own.

death_oclock 103 Posting Whiz

I honestly don't know why the write operation is inserting instead of overwriting. I can point out that you should put l = file.getFilePointer(); BEFORE you you read the line because the read operation will move the pointer to after the line.

death_oclock 103 Posting Whiz

We can help you better if you post the relevant code as well.

death_oclock 103 Posting Whiz

Ark's approach is much neater and most likely works. Your solution is very hard to read; the looping approach makes more sense.

death_oclock 103 Posting Whiz

Purely for the sake of simplicity, I would go with this route (doesn't use a second set of variables):

int main( int argc, char *argv[] ){
  int *numberlist, i, n, min, max ;

  n = atoi( argv[1] );
  numberlist = ( int * ) malloc( n * sizeof( int ) );
  for( i = 0; i < n; i++ ) numberlist[i] == rand() % n ;

  minmax( numberlist, n, &min, &max );
death_oclock 103 Posting Whiz

For the purpose of adding a one dimensional array works well enough in representing a matrix. For more complicated operations though, it would likely be easier to define a matrix like int mat[rows][cols];

death_oclock 103 Posting Whiz

Try posting a sample file generated by your program. Off the top of my head, I can't think of anything that would cause this.

death_oclock 103 Posting Whiz

Have you tried uploading it again? Tried uploading other files? This seems to have nothing to do with your C++ program.

death_oclock 103 Posting Whiz

The browser wouldn't make a difference if you use the same one to view pages on you local server as on your byethost server. Have you looked at the html source of both pages? I use byethost myself and uploading a file has never done this.

death_oclock 103 Posting Whiz

Does your page try to run the .exe to generate the new page? Byethost disables the running of executables for some pretty important security reasons.

death_oclock 103 Posting Whiz

Do you already have the part of the query that matches the site? Add to that (with an AND clause) a MATCH(field) AGAINST('value') as demonstrated in the link I gave you.

death_oclock 103 Posting Whiz

Try looking at this page.

Will Gresham commented: Brilliant link +1
death_oclock 103 Posting Whiz

Oh wow, how did I miss that part? Sorry 'bout that one.

death_oclock 103 Posting Whiz

Honestly, you have been given the proper solutions. Sending (and therefore, reading) your forms with the POST method sends variables through the headers sent. For this purpose, however, I would recommend SESSIONs as people could potentially look at the header information. SESSION variables are contained solely on the server (aside from the associated client COOKIE which only contains the SESSION ID).

death_oclock 103 Posting Whiz

While this is not critical in any way, you should note that the large outputting section at the bottom won't actually print any of the embedded quotes. In this line:

cout<<"Each ""generation"" eight babies are born with variations." << endl;

You are actually writing separated strings but the compiler is concatenating them for you, so no error is given. You want something like this:

cout<<"Each \"generation\" eight babies are born with variations." << endl;

The backslash make it into a special control character.

I'm impressed at the use of genetic programming; I'm doing some work with it as well. As for use of objects, anything more complicated could like use objects to store genes and whatnot, instead of using strings like you did in this example.

death_oclock 103 Posting Whiz

Instead of making us download your .zip file, post some sample lines of the .dat file, including ones that do work and ones that don't (ie. Truman).

death_oclock 103 Posting Whiz

When AncientDragon wrote Code[h] != 0 , his code was correct. Yours isn't. Why? AncientDragon's codes array was a string literal, which automatically has a '\0' or 0 value at the end. Your array does not. Either append a '\0' element or change your codes array to look like AncientDragon's.

death_oclock 103 Posting Whiz

Are you familiar with databases? Databases contain tables, tables contain records, or "rows". Each row has multiple "columns" of data. I am saying that each record should have information stored for each field I mentioned. Maybe you should find a good MySQL tutorial.

death_oclock 103 Posting Whiz

Each mysql record is one message, contains the message body, title, time etc. and the users it is to and from. The user fields would optimally be references to the ids inside a user table. You can then perform queries to get all the message to a user (inbox), all messages from a user (sentbox), and whatever else you desire.

death_oclock 103 Posting Whiz

I learned so much from this tutorial.

death_oclock 103 Posting Whiz

He meant for you to look at your notes. Doesn't using the resources you have make sense?

death_oclock 103 Posting Whiz

You're not displaying anything. Unless there's more to the code on this page, I don't see a single output statement.

death_oclock 103 Posting Whiz

No hard feelings. You should mark this as solved, however. It makes a difference.

death_oclock 103 Posting Whiz

I hope you mean "can't save .php files"! And I hope you're lying, because you can save a file with any file type you want :\

death_oclock 103 Posting Whiz

can i used it the in second page query.?

Yes, thats the whole point of sessions; they last across all pages in your site until they expire or the browser is closed.

It looks to me like you would put it in here:

$query_recstudinfo = sprintf("SELECT * FROM studentregistration WHERE username = %s", GetSQLValueString($_SESSION['MM_Username'], "text"));

I am unsure of your page flow, but I assume $_GET no longer exists on this page? If this is true you can ditch the part about getting that value. Just use your session.

death_oclock 103 Posting Whiz

Alignment like notepad, add styles? Your question is way too vague for anyone to know how to help you. Some details would be quite useful!

death_oclock 103 Posting Whiz

A semicolon can be useful in some preprocessor commands (probably some bizarre scenario), for example its perfectly valid in a #define statement. In this case we do need to know the compiler and its definition of #pragma because its functionality is not standard.

death_oclock 103 Posting Whiz

If you go back to the origional code you posted, a quick fix would be to quit program execution after outputting that message. So you could change that section to:

//Let the user know everything went ok.
                        echo "<p><b>You have successfully sent a private message!</b></p><br>";
die();

This is not a great solution, however; if you want to do anything else on the page it simply wont happen if your program gets to this point. Also, it is just considered bad practice to kill your program abruptly rather than using control statements. That said, I only suggest this to avoid diving deeper into your code. Have you learned much PHP? You should really go through a good thorough tutorial before working with advanced things like this.

death_oclock 103 Posting Whiz
<td width=""><p><?php echo wordwrap($message, 75, "<br />", true); ?></p></td>

Change 75 to whatever width you want.

serdas commented: thank you +1
death_oclock 103 Posting Whiz

No, the copy constructor is used only when called explicitly or when an object is being initialized. You could, however, have the assignment operator call your copy constructor.

death_oclock 103 Posting Whiz
int fileSize = strtoul(parts[5].data(), NULL, 0);

strtoul is defined in cstdlib

death_oclock 103 Posting Whiz

It will not modify and addresses but it will set all of the values of shoe_copy to the values of shoe1. It wont call a copy constructor. I have seen this called a "shallow copy" (here)

CPPRULZ commented: EXCELLENT link +1
death_oclock 103 Posting Whiz

My problem was not with your skill level because yes, I have been there. My problem was with your attitude.

death_oclock 103 Posting Whiz

I cant do it I think I should give up....

Maybe you should. Programming can be confusing and frustrating. If you can't deal with that even from a simple problem like this, maybe programming isn't for you.

death_oclock 103 Posting Whiz

TommyBs is right. You don't need 's around your field names, and definitely don't use `. Is there in fact a field named status? And try doing this query directly in MySQL (via phpMyAdmin if you have it) and see what error you get.

death_oclock 103 Posting Whiz

Hmmm, so you look for records with the user's selected year in it, thats where I would have started. But if we don't find any such rows, then it must already exist? I think not. Try $total > 0 .

death_oclock 103 Posting Whiz

Backticks are not the same as single quotes. read

death_oclock 103 Posting Whiz

printf ("*",i); What is that supposed to do? Read up on printf. Just a hint, it doesn't print "*" i times. And adding a tab before every *? I don't think thats what you want.

death_oclock 103 Posting Whiz

It may seem strange at first, but try making the diamond yourself. Go through it slowly and see exactly what your thinking is on how to do it. Unless you can understand it yourself, you won't be able to make a computer do it.

death_oclock 103 Posting Whiz

I don't see you putting any spaces to the left of your rows. C won't automatically middle align it for you...