I'm not sure what your goal is with num_data. You're on the right track with the % operator, but for loops are designed for... looping. I believe you want something more like:
if(even_test)
{...
Type: Posts; User: Brad0407
I'm not sure what your goal is with num_data. You're on the right track with the % operator, but for loops are designed for... looping. I believe you want something more like:
if(even_test)
{...
I doubt that you want to initialize the pointer in the while loop. That will destroy your tree every iteration. And by initialize the pointer, I assume you mean:
T = NULL;
Like Salem said "freeing something that wasn't allocated to begin with" will cause a seg fault which is the case here.
You are using makeEmpty before T is initialized. When using pointers, you...
The classical solution to this problem: Dijkstra's algorithm. A* would also work, but without a good heuristic, it wouldn't be much of an improvement.
You program works for me. I copied the code above and all I changed was %f's in scanf to %lf's and FILE *inp, outp; to FILE *in, *outp;
nvm
If you're making a temp copy of the new file anyways, why not just close the file and reopen it for writing "w". That will erase everything.
>> What's wrong
You didn't use
tags and you posted C code in the C++ forum. You also didn't tell us anything about:
1. What input you're giving the code
2. What output you expect
3. What...
Tokenize isn't a standard C++ function. I got if off this website.
You can also check the FAQ for more detail on tokenizing.
I don't think you can do what you want with getline, but you can read in the whole line and then use OneString.find_first_of (if you want them one at a time) or Tokenize (to get all the strings at...
If there are more than 2 lines and you only want the first 2 of them, you're going to have to do one of the ways that Daved suggested. Here's the way I would use:
// open infile
// for each of...
I think you should take (count < 3) out of the while loop.
void delayMessage(){
char delay;
printf("\n Please press enter to return to the main menu\n");
scanf("%c",&delay);
}
You have to pass a the address of delay to...
Yea, I'm struggling with words today. I was thinking of unicode when I wrote that. Thanks for clarifying.
Calm down there, buddy. I see your point. There are 2 main objections that I have but I can see where you're coming from. It's not a big deal anyways.
It's for portability. Sometimes characters are 1 bytes. Sometimes they are 2 bytes for extended characters like chinese characters. In the future, it may be even more. So toupper takes an int to...
To abachler:
I think everyone agrees that AI has no free will and some people think that humans don't have free will (hard determinism). What are you arguing? I'm sorry, your post just seems off...
Every experienced programmer on this forum and many programmers that are still learning. I didn't bother to count.
That is not the output I get. Are you sure it isn't this:
int i = 9;
for (i--; i--; i--)
printf("%d", i);
If you code overflows, it made a number that was too big for it to store in whatever datatype you were trying to store the number in. It's possible that you're doing "ridiculously high calculations"...
char InBuff[8] = "12345678";
"12345678" is a string literal. It's actually 9 characters long "12345678" <- your string + '\0' null terminator. So basically you have an array bounds overflow. It...
This code would need to be in the constructor and you would need to pass the filename to it.
ifstream file("dictionary.txt");
if(!file)
{
cout <<"\nError! The file couldn't be opened\n";
}...
typedef is used to define an alias for a type. I think typedef stands for typedefinition.
If I wrote this statement:
typedef char letter;
letter my_letter = 'a';
printf("my_letter = %c\n",...
void box(length, width, height)
length, width, and height are variables and you need to specify types for them. In the prototype these variables all have type "int":
void box(int length, int...
This is all I could find
3 Problems with that:
1. That's a big example.
2. Not very specific. I don't know what the invoices are supposed to look like, what's being purchased, what the shop's logo looks like, etc...
3....