Forum: C++ Jun 2nd, 2009 |
| Replies: 13 Views: 900 To make it a more secure method, you could do a binary write to the file with the time of day (in clock ticks) that the file was written, the number of guesses that occured, and a strange binary... |
Forum: C++ Apr 28th, 2009 |
| Replies: 35 Views: 2,009 This would require a data aquisition card, an instrumentational amplifier attached to a very sensitive inductor, and amplified so that the minute changes in electrical forces in the air generate a... |
Forum: C++ Apr 28th, 2009 |
| Replies: 35 Views: 2,009 Umm...What point was made, exactly, with that post?
and kelechi96,
don't get discouraged too much, some of the people around here can be a little ignorant at times, but will usually help you out... |
Forum: C++ Apr 28th, 2009 |
| Replies: 11 Views: 496 I would sugguest attending class. |
Forum: C++ Apr 28th, 2009 |
| Replies: 35 Views: 2,009 An example of this would be to measure the amount of electrical energy in the air at any given point using some sort of analog device, which then converts this into a voltage difference, which is... |
Forum: C++ Apr 24th, 2009 |
| Replies: 25 Views: 1,684 Your function makes little to no sense to me. Just think about injecting test values into it. Say you pass it 5, base 10:
5 / 10 = 0.5 = 0 (int)
"0123456789abcdef"[0 % 10] = '0'
Well damn. ... |
Forum: C++ Mar 5th, 2009 |
| Replies: 6 Views: 688 I don't understand why your are interchanging null terminated c style strings with the String class. The string class alone should suffice here and it handles its own memory (and also contains an... |
Forum: C++ Mar 2nd, 2009 |
| Replies: 18 Views: 684 Hey thrashing the thrashers is just as hypocritical as hating all racists. |
Forum: C++ Mar 2nd, 2009 |
| Replies: 18 Views: 684 Use a for loop. And show some freakin effort! |
Forum: C++ Jan 20th, 2009 |
| Replies: 4 Views: 1,096 It's easiest to read it from right to left. int const * const reads constand pointer to constant integer. Meaning the pointer value won't change, and the pointed to value won't change. No effect... |
Forum: C++ Jan 19th, 2009 |
| Replies: 14 Views: 762 Unless its an RTTI assignment, you probably shouldn't use it. Use the method I described earlier. |
Forum: C++ Jan 19th, 2009 |
| Replies: 6 Views: 1,301 Hard to tell when you don't show us the context in which they are used. |
Forum: C++ Jan 19th, 2009 |
| Replies: 14 Views: 762 If you have to use RTTI as part of the assignment, then google it. Otherwise do as the others sugguested. Implement in the base class (the one you derived the 2 accounts from?) a virtual method... |
Forum: C++ Jan 19th, 2009 |
| Replies: 4 Views: 1,912 What they are trying to say is, it's bad practice to exit your program spontaneously. Objects would be left undestroyed, memory orphaned, and it just doesn't look professional. Instead, use logical... |
Forum: C++ Jan 19th, 2009 |
| Replies: 4 Views: 1,096 I don't think that would help the performance. If anything, it would just increase build time by about a few clock cycles (setting a const flag). If you actually broke down the code you write into... |
Forum: C++ Jan 10th, 2009 |
| Replies: 9 Views: 760 You can load the files in using the fstream.
ifstream inFile;
vector<string> data;
inFile.open("File.txt");
while (!inFile.eof())
{
string sString = inFile.getline();
... |
Forum: C++ Jan 9th, 2009 |
| Replies: 2 Views: 520 Your map code seems fine. Maybe post more code, where s and v are declared. It seems like this wasn't copied and pasted, since there's a few program-busting spelling mistakes in it. You might... |
Forum: C++ Jan 9th, 2009 |
| Replies: 9 Views: 760 As for the actual problem, I would go with a simpler method. Simply push all the keywords into a vector of strings, then load in the file to check against (a txt file) into another vector of... |
Forum: C++ Jan 9th, 2009 |
| Replies: 9 Views: 760 If you are using VS2005+ press ctrl+a+k then f. This will run a macro to format all of your indents perfectly =) |
Forum: C++ Jan 6th, 2009 |
| Replies: 11 Views: 1,042 How about...don't read the file twice!! It's practices like this that cause execssive wear on harddrives. Why not load everything in the file into memory (an array/vector)? You will find that RAM... |
Forum: C++ Jan 6th, 2009 |
| Replies: 7 Views: 809 This is just semantics. It doesn't matter at all. In fact, it's faster to make them all members (from a coders perspective) since you need one less argument per operator. |
Forum: C++ Jan 6th, 2009 |
| Replies: 7 Views: 809 The reason for using const modifiers is for situations like this:
Point const X(5, 2, 3);
Point Y(0, 0, 0);
Y = X;
Since x is a const, the previous version of your code will not work, but the... |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 here's what i used to test it:
#include "NumberList.h"
#include<iostream>
using namespace std;
int main()
{
NumberList mylist;
cout<<"Adding 5..."<<endl; |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 Well it's up to you, really. Taking out the - 1 in the while loop will adjust it to what you want. |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 This seems to be working fine... I made a list of 5, 10, 20, 30, and then insertedbypostion @ 2, and got the list 5, 2, 10, 20 , 30. Isn't this what you want? |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 Arrg I'll compile it and see what I can find out for you :P. Post the whole code (or better yet attach a zip of the whole project) |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 The position should still be -1, so in the while loop, use
while (nodePtr !=0 && position < pos - 1)
also, init position to 0, not 1 |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 I think the if(pos <= 1) should be if(pos < 1), since 0 is the head. |
Forum: C++ Nov 14th, 2008 |
| Replies: 15 Views: 816 Hmmm perhaps you should be comparing to position - 1, since 0 is counted. While something may be in 3rd in the list, it would be counted as 2nd since position starts at 0. Position will always... |
Forum: C++ Nov 2nd, 2008 |
| Replies: 14 Views: 836 At a glance I saw more than 15 syntax errors. I'm way too lazy to point those all out... you have [] around a cout statement - that would probably make a compiler explode. You have ; all over the... |
Forum: C++ Nov 2nd, 2008 |
| Replies: 4 Views: 411 remember that an array's max index is always 1 less than its size, since 0 is included. So for part 1,
numberArray[0][0] = 148;
and #2
numberArray [8][10] = 18; |
Forum: C++ Nov 2nd, 2008 |
| Replies: 6 Views: 483 Hmmm I think using chars should be fine. Post the whole program and I'll race you to debug it. |
Forum: C++ Nov 2nd, 2008 |
| Replies: 3 Views: 469 int list::recursion(int item, int position, node * temp = startPtr)
{
if (temp->next)
{
if(temp->item != item)
recursion(iItem,... |
Forum: C++ Nov 2nd, 2008 |
| Replies: 6 Views: 483 For problems like this, I would step through the code (via F10 to step through and F11 to step 'in' in VC++). Keep an eye on your local variable list, and as their values change make sure that they... |
Forum: C++ Oct 29th, 2008 |
| Replies: 21 Views: 1,479 I'd recommend you either #ifdef #define something at the start of your .h file, or use a #pragma once line to ensure it isn't being included multiple times. |
Forum: C++ Oct 27th, 2008 |
| Replies: 2 Views: 362 I don't understand your for loop (which is also syntactically erronous) , or the do loop. Just get rid of them for now, and implement them later if need be.
Hmm you are using the switch syntax... |
Forum: C++ Oct 27th, 2008 |
| Replies: 5 Views: 446 I suppose if you were writing software for something with very little available memory (ie a cell phone), it could become a problem. But now I'm just getting off topic. |
Forum: C++ Oct 27th, 2008 |
| Replies: 5 Views: 446 Also, checking to see if the pointer is NULL is a method of checking if the memory was actually allocated. But an exception will halt the execution before this can be checked, so the nothrow arg... |
Forum: C++ Oct 27th, 2008 |
| Replies: 5 Views: 446 Hmmm. Maybe you should include the code to make the program run? Also, I would sugguest using inheritance rather than unions for this (like ancient dragon said). Here's the drawer header my school... |
Forum: C++ Oct 25th, 2008 |
| Replies: 8 Views: 464 Hmmm i never realised that the class only represents 1 toy. Ignore the part I said about arrays, but still fix the recursion issue. |