Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You people are making a mountain out of a molehill.

int main()
{
char arr[] = {'a', 'b', 'c', ' ', ' ', ' ', ' ', ' ', 'd', 'e', 'f', '\0'};
char *p1, *p2;

p1 = strchr(arr,' '); // find 1st space
p2 = strrchr(arr,' '); // find last space
if(p1 && p2)
   memmove(p1,p2+1,strlen(p2)+1); // remove all spaces
cout << arr << "\n";

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just zip up the whole project (minus object files) and attach them to your post so we can test it for you.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I suppose its just personal choice whether to use the document class or not. Myself, I have always used it, and there are a few things that MFC can't do (or easier to do) without it such as iterating through all the views of the same document.

If you are going to write just a simple drawing program, then you could start with the MFC tutorial named Scribble

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You have to use [code] ... [/code] instead of <code> ... </code> The angle brackets don't work here.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are you sure you have the prequisits for that course? It sounds pretty advanced for a beginner.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

the loop on line 10 will never execute because the condition j > i is always false -- they are initialized to the same value (100).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If its so trivel post the code. Your code needs to come up with
562262574607502830000000000000000000000000000000
00000000000000000000.0000000000


That number is too huge for normal c-language math.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have no idea how your teacher's program works -- you would have to post it. I can only suspect he used one of the huge integer libraries like I previously suggested. Its also possible he used strings instead of integers to avoid the limitations of integers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

search the registry for all instances of yahoo then delete the keys that belong to messenger.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another way to change it:

Start --> Control Panel --> Folder Options

You have to be logged in with Administrator privledges in order to change any of those files. I would strongly suggest you leave them alone because you might wind up having to reinstall the operating system if you screw them up.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you want huge numbers then use one of the many huge integer libraries. I think boost has one and here is another.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its integer overflow. Add a cout in the factorial function and you will see it. Integers, regardless of size, can only hold a finite value. When that value is exceeded the result is undefined and unpredictable.

long long factorial( int num )
{
	long long answer = 1;
	while ( num > 1 ) {
		answer *= num;
		num--;
	}
cout << fixed << answer << "\n";
	return answer;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include <algorithm>
...
...
cout << fixed << result << endl; // I use this here to see the results of the factorial
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is that inline assembly code I see in both your programs? I guess you don't code for portability so that the code can be compiled by other people using other operating systems and/or compilers. And I'm sure a programming teacher would deduct points for that, unless its required as part of the assignment.

>>Personally I prefer speed to readability
Depends. Maintainability (and readability) are pretty important in the real-world.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Now this page is even more interesting!!

http://www.computerhistory.org/internet_history

w0w,back to the 60s!! (I had forgotton about Arpanet)

That link is all just bs. Everyone knows Al Gore invented the internet.

Alex Edwards commented: Funny comment =P +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know Python so I can't really give any recommendation on that. In fact, .

Starting Python

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You might need to revise this, as it will only remove one white-space.

That code must be put in a loop in order to remove other instances of multiple white spaces. I did not intend to post the entire solution, only a suggestion about how to go about solving it.

Not to mention the use of these tools for what should be simple strings is pretty dangerous!

memmove() is intended only for character arrays, not std::string. All C style string functions can be dangerous if the programmer uses them in a haphazard manner.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you can use memmove() to shift everything left one place to overwrite the second consecutive space.

char str[] = "Hello  World";
char* p = str;
while( !isspace(*p) )
   p++;
if( isspace(*p) && isspace(*(p+1)) )
   memmove(p+1, p+2, strlen(p+2) + 1); // + 1 to also move the NULL terminator
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are trying to use the wrong getline(). For data type std::string you use getline(cin, videoTitle)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

why use recursion when a simple loop will do. Loops are always faster than recursion (and less memory/stack intensive too).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
nt product(int b,int e)
{int x,p=b;
	for(x=1;x=e,x++)
	p=p*b;
	return p;
}//End case no1

//this is for the case no.2
long long int factorial(int no)
{int Loop,F=1;
	for(Loop=1;Loop<no;Loop)
	{F=Loop*F;
	<<Loop;
	}
	<<F;
}//End case no2

The above has at least two problems:
line 3: x=e you are using the assignment operator = instead it should probably using the < operator.

line 11: The third part of that loop statement should increment the value of the loop counter -- yours doesn't do anything.

line 13 and 15: I have no clue what those two statements are attempting to do. The << operator doesn't make sense. Maybe you meant ++ (increment operator) ?

I see you use long long data type in several places. To my knowledge TurboC compiler doesn't know what that is. If you want to use long long then you need to use a newer compiler that knows about 64-bit longs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what's not working? what doesn't your program do that you want it to do? You need to explain the problem. Do you take your car to auto repairman and say "Its broke, please fix it"?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>start = std::clock(); //reset clock
You can't use namespaces in *.c files.

Nick Evan commented: Oh duh... What the hell was I thinking? +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>I was trying to figure this out but for some reason it is illuding me

you will have to be a lot more specific than that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are using a Microsoft compiler, put your cursor on the object you want to find and right-click. That will bring up a pop-up menu which will give you the option to find the declaration of the object or class.

If you are new to COM programming, buy a book because it is a very complex subject.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is one.

Just google for "multithreading tutorial" and see what it comes up with. Some may be for other languages, such as java, that you may not be interested in.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

that's what I am wondering too.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

binary files do not have lines -- they are just a stream of bytes that could contain anything between 0 and 255. What you are talking about is a text file, not a binary file.

Post the actual input file, not just an explanation of what it contains.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yes, very simple. Ifstream makes the appropriate conversions for you.

short sValue;
int iValue;
long lValue;

ifstream in ("somefile");
in >> sValue >> iValue >> lValue;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

your program has to do everything -- count the number of lines printed and when the screen fills up display the message then wait for user input to continue.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You can't compare directly (without operator overload) an instance of another clas (node->item) with c++ strings.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

my GUESS is that item and first_name are character arrays. If that is right then you have to call strcmp() to check if the two strings are the same. Or you can change them to std::string.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I agree, tell a friend widgets will help you to drive traffic from your existing traffic. Check out this youtube video, it may help you to understand word of mouth marketing

The link doesn't work -- its apparently restricted for some reason.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That zip file doesn't include the *.cpp and *.h files so I just copied them from your last *.zip file.

Continuing from where I left off
vcdrec.cpp: you forgot to include <fstream> which is where ifstream is declared.

Then you misspell the name of the ifstream object every time you used it.

You have confused Load_Record_From_File() and Load_Save_To_File(). Switch the code in those two functions around. And I think the filename used in both those functions should be the same. You can't write the data to one file and expect to read from a different file.

After correcting all the above your program is left with several functions you have not yet coded. The link error messages will tell you which functions are missing.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If the account balance is 0 my guess is that the account should be closed and just delete it. That would probably indicate the person withdrew all the money so that he could go buy a new computer and is no longer interested in putting his money in your bank.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1) the read loop is all screwed up

int pos = 0;
while( read >> array[pos] )
   pos++;
// now that you have all the numbers in an array, just add them
// up the way you want them
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

prompt.h: missing the return type of all functions.
prompt.cpp: ditto (same problem)

your zip file contains 4 different projects. That's not what you want. You need to put all those files into just one project so that they can all be linked together.

Dave Sinkula commented: Kudos for taking the time to look. +17
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>A long doesn't have endianness;
I disagree -- try transferring via socket a long from *nix to MS-Windows without conversion. You will wind up with crap.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

not quite

void foo(int*& d){

 cout << "d = "<< *d << endl;

}

int main(){
  int   a  = 5;
  int*  d  = &a;

  foo(d);

  return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

hmm .. but isn't *(&head) basically trying to de-reference the address of head ?

If you are talking about line 74 -- no. int*& head is a reference to a pointer -- much like a reference to any other object. The equivalent in C is the double star. But in C++ only a single star is used and the & refernece operator and makes the dereferencing easier

// C code
void foo(int ** head)
{
    if( *head == NULL)
}

// c++
void foo(int *& head)
{
   if( head == NULL)
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The system used here is optical mark recognition. The ballots look like this.

That looks like the same thing we have here in southern Illinois.

Voting via internet would be ideal, but too prone to fraud.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It may be on *nix, but put the same code on MS-Windows without changing the code and it will produce the wrong answer. That makes the statement false absolutely little/big-endian neutral specification. because the same code doesn't work right on both machines.

Or maybe I'm just being pigheaded :)

Nick Evan commented: Great discussion! +10
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 24 of the *.cpp code: you have to set nextPtr->nextPtr to headptr before setting headptr = nextPtr. If you don't do that you will lose all the new nodes in the list.

if (num == 0)
{
    ListNode* nextPtr = new ListNode;
    nextPtr->nextPtr = headPtr;
    headPtr = nextPtr;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your function prototype .. int delfn(acmetype *&head) .. doesn't make any sense.

That makes perfect sense to me -- it's a reference to a pointer. In C language it would be the same as int delfn(acmetype** head);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

None that I know of. But you might look at a copy of Undocumented Windows book. To my knowledge events go directly from the keyboard and mouse device drivers to the thread that has input focus.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thanks -- I suspected that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what are the mistakes? what are the error messages ? what operating system? what compiler ? In otherwords, don't just toss some code out there and expect everyone to correct it. You need to explain what you want or what the problems are.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how will n = a|(b<<8)|(c<<16)|(d<<24); be portable regardless of endian ? You still have to shuffle the variables to match the endian setting.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Creating another thread is pretty trivial, depending on the operating system. For example, in MS-Windows just call CreateThread() leaving most parameter values 0.

#include <windows.h>

DWORD WINAPI ThreadProc(void* lpParameter)
{
    // put your timer code here


    return 0;
}

int main()
{
      DWORD ThreadID = 0;
      CreateThread(0,0, ThreadProc, 0, 0, &ThreadID);

}