Forum: C++ 2 Hours Ago |
| Replies: 3 Views: 122 a = (rand() % 3) - 1;
generates numbers in the range -1 to 1, is that what you intended? |
Forum: C++ 11 Hours Ago |
| Replies: 21 Views: 342 Not sure what you're asking about the first code block.
In the second code block, lines 10 and 16 (where you set and output cosangle) need to be past line 46 (where dvaIndexLast = dvaIndex)
And... |
Forum: C++ 15 Hours Ago |
| Replies: 21 Views: 342 At first glance, I thought the first code you posted showed the data going to two files at once (if i < 100), but then I noticed the else (on line 6 of the code below). As written, the first 100... |
Forum: C++ 20 Hours Ago |
| Replies: 21 Views: 342 Ok, first, based on your answers to the questions, the file sizes represented do NOT warrant the work and/or effort to split the files up. In fact, if you're going to use this data for anything... |
Forum: C++ 1 Day Ago |
| Replies: 3 Views: 122 It would depend on how smart you want the computer to play. The smarter you want the computer to be, the more work it will be.
You will likely end up adding a function that will 'make a move' like... |
Forum: C++ 1 Day Ago |
| Replies: 21 Views: 342 I don't see any answers to the questions. I'll quote the questions again here, but I will not reply to this thread again unless you answer them:
Regarding your last post, did you even bother to... |
Forum: C++ 3 Days Ago |
| Replies: 3 Views: 148 You're iterating too far.
The element indexed by cnt wasn't fully read.
On Line 25 the loop limit should be i < cnt not i <= cnt |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 Ok, I was going to compare the strings, but I decided that was inefficient so I switched to integers.
// I'm using strings
#include <string>
// I'm using stringstreams
#include <sstream>
... |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 You appear to be having an extremely difficult time following what I thought were simple directions. I am apparently failing to communicate.
Let's get back to basics first.
Questions -- please... |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 First, let me repeat again, at the sizes you are currently configured for, breaking the output up into multiple files is unwarranted.
If we're only at the testing level now (with N at 100 and... |
Forum: C++ 4 Days Ago |
| Replies: 4 Views: 200 You need to seek before you read (saw you have that), but you need to seek to the same location before writing (by default, the act of reading moved the file pointer).
//Insde main:
else... |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 I thought I showed you what I recommended.
I thought I showed you that you could take the output out of the big loop.
The goal would be not to repeat the same code for as many times as you have... |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 I was thinking something like this, but I would much rather have seen you try something than just give it to you. Demonstrate effort, you get lots more help.
int nextindex = 0;
for (int ii = 1;... |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 I understood what you said you wanted to do.
Apparently you didn't understand what I was recommending.
Right now you have something like this:
ofstream ofile;
... |
Forum: C++ 4 Days Ago |
| Replies: 4 Views: 200 I think your problem is that you don't read the records from the file when you're making changes to them.
For example if the first thing I did after starting the program was to check-out or... |
Forum: C++ 4 Days Ago |
| Replies: 21 Views: 342 200 lines of code is not unreasonable to post, you should just have posted it in code tags. (There are lot of people that won't download code. I don't do it very often.)
The "vecA" files would be... |
Forum: C++ 5 Days Ago |
| Replies: 1 Views: 110 I wouldn't use multi-threading in this type of application.
You might look at using something from the _spawn family of functions using the _P_NOWAIT setting in place of your system() call. They... |
Forum: C++ 5 Days Ago |
| Replies: 6 Views: 170 I don't see anything obvious about the login...maybe you could describe the problem you're having better?
As not all of the code required to validate the login is shown, I'm presuming that all of... |
Forum: C++ 5 Days Ago |
| Replies: 23 Views: 311 Specific comments on your code posting:
You still have not added any debug prints to track your way through your program. From your comments about how your program runs, I'm presuming that you... |
Forum: C++ 5 Days Ago |
| Replies: 23 Views: 311 I have to agree with Dave...it almost looks like you aren't trying.
I took your last posted code and did the following:
modified it to support the number of grades you actually have
(Which... |
Forum: C++ 5 Days Ago |
| Replies: 7 Views: 291 There may be design issues here...
The base class can declare any function it likes as pure virtual, but all of the child classes must implement it using the same concrete argument list.
If... |
Forum: C++ 5 Days Ago |
| Replies: 23 Views: 311 I don't see anything obvious about why your code would just stop without exiting.
I guess your next step is to either run the program in the debugger (if you have one) or to add debug print... |
Forum: C++ 5 Days Ago |
| Replies: 8 Views: 213 So your array class is intended to transparently represent the result of possibly many allocations as a single array. Due to the HUGE size of the array, it is absolutely CRITICAL that the allocation... |
Forum: C++ 6 Days Ago |
| Replies: 23 Views: 311 If you don't have a compile error, you can add debug print statements (or run in a debugger) to determine how far into your program it gets.
I'd at least add a print before you read the id with... |
Forum: C++ 6 Days Ago |
| Replies: 8 Views: 213 I don't see much point in allocating all available memory unless you're trying to stress-test another application, and if you're stress testing, I'm not sure what the hurry is.
I'm pretty sure you... |
Forum: C++ 6 Days Ago |
| Replies: 23 Views: 311 if you're getting a compile error, would it trouble you too much to include the error? |
Forum: C++ 6 Days Ago |
| Replies: 8 Views: 213 If the data is large enough, I suppose it can take a while, but I've done some fairly large data sets and never really felt the need to 'speed up' allocation.
How much data are you allocating?
... |
Forum: C++ 6 Days Ago |
| Replies: 1 Views: 162 Unless I'm mistaken, your code won't compile.
The first problem is that the compiler doesn't like you to declare the size of an array at runtime, it wasn't to know how big the array will be at... |
Forum: C++ 6 Days Ago |
| Replies: 6 Views: 164 and you forgot the around your code so that it is highlighted and has line numbers.
(oops didn't see the previous post -- sorry) |
Forum: C++ 6 Days Ago |
| Replies: 6 Views: 164 Also, when posting your code for us to look at, please use code tags:
// Your code goes here
It makes the code MUCH easier to read. (There are several people that won't even look at your... |
Forum: C++ 6 Days Ago |
| Replies: 23 Views: 311 His line 12 should have been ++cnt;
Though I agree with a previous poster that you have 8 grades, and do not have an average or a letter grade in your input file, which makes his sample code... |
Forum: C++ 6 Days Ago |
| Replies: 8 Views: 213 Why don't you want the memory set to zero?
Are you trying to extract some 'previous' value from the memory? |
Forum: C++ 7 Days Ago |
| Replies: 7 Views: 291 The compiler requires that the 'interface' function1() declared in the base class have a concrete argument list.
What kind of abstraction do you think it needs?
Could that abstraction be... |
Forum: C++ 8 Days Ago |
| Replies: 22 Views: 391 The reason you lose the first character of the title is because the first loop is different from the second and third loop. Look at the difference yourself and see if you can figure it out. You're... |
Forum: C++ 8 Days Ago |
| Replies: 4 Views: 315 Templates require the users to see all of the member functions. You can't have the methods 'hidden' in a c++ file.
If the code creating the instance of the template doesn't "see" the method, the... |
Forum: C++ 8 Days Ago |
| Replies: 22 Views: 391 You're losing the first character of the full name inside the first for loop (of concat()). The second and third loops add each character to what was in fullname, but the first loop assigns each... |
Forum: C++ 9 Days Ago |
| Replies: 14 Views: 231 The basic code you were given declares the array and then passes it to the functions you are supposed to write. |
Forum: C++ 9 Days Ago |
| Replies: 14 Views: 231 Based on what you have there, I suspect you're supposed to write the two functions:
int empty_array_insert(int[], int);
void display_in_reverse(int[], int); |
Forum: C++ 9 Days Ago |
| Replies: 3 Views: 196 Assuming that your sort works...
if (n[0] == n[1] && n[3] == n[4] && (n[2] == n[1] || n[2] == n[3])) |
Forum: C++ 9 Days Ago |
| Replies: 12 Views: 407 I agree about the while in main, but were you trying to stop when the board was full?
You can't look at a single location to determine if the board is full.
Just another comment or two for... |