15,300 Posted Topics
Re: >>Any ideas?? Post the code that is giving the errors. We are not mind readers. | |
Re: >>for(wijzer=0;wijzer<=pointer;wijzer++) what is the value of [b]pointer[/b] >>switch(PIND) Why are you using a const PIND here? Can its value ever be changed somewhere else in your program? If not, then that switch statement has no purpose. | |
Re: If you really want to port it to c++ then use fstream instead of those very low-level file functions. Its really not all that difficult once you understand it. [code] #include <fstream> using namespace std; int main() { ifstream in(l_chBuff, ios::binary); // blabla } [/code] | |
Re: [b]do[/b] is the top of a loop [code] do { // something here } while ( <some condition here that stops the loop> ); [/code] I'm not going to answer the question you posted -- write a small test program and see for yourself what the answer is. Just post … | |
Re: what is the value of 5/9 ? Notice that is integer math, not floating point, so all decimals are lost. Once you understand that, its simple 2nd grade math to figure out the rest of the problem. | |
Re: In order to use shared memory with more than one process or thread you have to implement some way to lock the share memory so that no more than one process/thread is accessing it at any given instance. Semaphores are often used for that purpose. [URL="http://www.google.com/search?hl=en&q=process+synchronization&aq=1&oq=process+synch"]Read some of these links[/URL], … | |
Re: CreateDocument() is a member of a class, so in the application program you have to declare an instance of that class in order to call it, unless of course it is a static method. My suggestion is to export/import the entire class instead of just one method. | |
Re: >>#include "applicant.cpp" Never, ever, under NO circumstances, do this!! DO NOT INCLUDE *.CPP like that. Instead, compile them separately and link the object modules. How to do that depends on the compiler you are using. | |
Re: line 14: >> for(int a = 0; a <= NULL; a--) Do you know the definition of NULL? Answer: 0. That loop will execute as many times as it takes for a to wrap back around to a positive number, which could be a whole lot of iterations. [icode]for(int a … | |
Re: what kind of computer and operating system do you have? Amount of RAM and size of hard drive. You will need Windows XP with SP2 or Vista to run that compiler. If you don't have that, then you can download free [URL="http://www.codeblocks.org/"]Code::Blocks[/URL] or [URL="http://www.bloodshed.net"]Dev-C++[/URL]. Dev-C++ is getting rather old now … | |
Re: In a timer thread do this: [code] class MyObject { public: ... void Destroy() {delete this;} ... }; MyObject* obj = new MyObject; // in a timer thread obj.Destroy(); [/code] | |
Re: How to do it depends on the contents of file1. If file1 only contains one line of text then it should be pretty simple [code] ifstream file1("filename.txt"); ofstream file2("outfile.txt"); string input = "Hello World"; string line; file1 >> line; file2 << line << input; [/code] It becomes a little more … | |
Re: First, SetName() is attempting to copy the name to an uninitialized pointer -- guarenteed to crash your program bigtime. Instead of using a char* for Name why not use the c++ std::string class so that you don't have to worry about memory allocation and all the problems that go along … | |
Re: [URL="http://www.daniweb.com/forums/thread121245.html"]icon question/answer[/URL] | |
Re: You are confusing characters positions with string positions. Your program is not sorting the string in the list array but attempting to sort the characters in just one of the strings. And it doesn't do that very well either. 1) go back and review the selection sort algorithm and compare … | |
Re: An oboe, but I like piano and violin too. Don't play any instruments | |
Re: This can't be your first class assignment -- by now you must have some clue about how to write a program and studied input and output file streams. Like any other program, start small, break it down to small parts that you can program. For example, begin by writing a … | |
Re: Why not put your music degree to work in the IT field. I should think you could get a job at one of the big game houses providing and/or writing music for the games. You might also want to get back in school and get another degree in computer science. | |
Re: OMG Everybody wants to program games :) Game developers are a dime a dozen, so unless you are very very exceptional developer you should do something else. At any event, how much programming experience do you have? None: Then spend a few years learning the trade and maybe you will … | |
Re: Oh gee golly moses. [URL="http://www.tenouk.com/cnwinsock2tutorials.html"]This[/URL] was the first in the list of [URL="http://www.google.com/search?hl=en&q=winsock2+tutorial&aq=f&oq="]google links[/URL] | |
Re: Not directly, but there are a couple work-arounds. 1) use a series of if statements to test the string value then call the function [code] if( pie == "do_something" ) do_something(); else if(pie == "something_else" ) something_else(); // etc etc for all string values [/code] 2) use <map> to map … | |
Re: I like it, but can only play one key at a time because you have to use it like playing the piano with one finger. Now if there was a way to play it using all 10 fingers (and maybe toes too)! | |
Re: [URL="http://www.codeproject.com/info/search.aspx?artkw=com+and+managed+c%2B%2B"]CodeProject[/URL] has some articles that may help you. | |
Re: >>i want an instant answer With a title like that most people will just ignore you. And you have to be a lot more specific about what you need. There are billions of different answers to the crappy way you formatted your question or statement. | |
Re: >> I'm not sure why but I keep having alot of problems. What are the problems? Error messages? compiler you are using? Operating system ? | |
Re: I almost never read any of those blogs because they rarely have anything that is interesting to ME to read. But after reading this thread just now I went to have another look -- and sure enough there were a few non-technical blog entries, such as the one written by … | |
Re: The problem is at the last line of invoice.h -- a semicolon is required at the end of a class declaration. | |
Re: you should probably get the recommended book [b][i]Introduction to Computing Systems: From Bits and Gates to C and Beyond [/b][/i] and read it. I don't know the first thing about it, so can't help you. | |
Re: You are going to have to add more parameters to the bubble sort function. When the primary array members are exchanged, all the other array members must also be exchanged so that all the arrays are kept in sync with each other. Example: [code] void bubbleSort(string Name[], int id[], float … | |
Re: >>string ****Nipples; OMG what in hell are you trying to do here??? If you are trying to code an array of string's then its [icode]string Nipples[4];[/icode] But the reading part should look like this: (I hope you change the variable names before turning in the assignment because your teacher may … | |
Re: Its a difference in compilers and the way they handle floating point arithmetic. VC++ 2008 Express produces 0. Dev-C++ produces the value you quoted. Dev-C++ is an old compiler now and may have a few bugs. Maybe someone with CodeBlocks can try it to see if the bug has been … | |
Re: you are attempting to pass an array of strings to getSize(), but it only expects an array of characters. getSize() is nothing more or less than your own version of the standard C library function strlen(). | |
Re: >>How can I monitor every little step of the function like that? 1) use a debugger or 2) take a short test string and follow it manually. For example: "H W". Initially variables i and j are both 0, so it will just copy the character 'H' onto itself, then … | |
Re: I don't see a problem with that code. It is legal and ok for a class to return a string like that. | |
Re: you could put it in a function so that it can be called as many times as you like. | |
Re: First, do you know how to read a file in C language? If not, [URL="http://www.cprogramming.com/tutorial/cfileio.html"]here's a tutorial[/URL] The position in problem #1 can be interpreted a couple ways depending on how the file is formatted. If all the numbers are on one long string, then the position will be the … | |
Re: sum them all up and divide by the size of the array. For example [code] int a[3] = {2,4,6}; The sum is 2+4+6 = 12 The average is 12/3 = 4 [/code] | |
Re: m_Test is apparently a member of cls class. CreateInputFilter() is not a member of that class, so it doesn't know what m_Test is. | |
Re: You use dll functions all the time in c++ programs. Every win32 api function and every standard c and c++ functions are contained in dlls. (they could also be statically linked, but that's for another discussion) So use your dll just like the others, include the header file and link … | |
Re: The first parameter to averageGrade() is supposed to be an int array, you are attempting to pass an array of Student classes. The second parameter is supposed to be the number of elements in the first parameter -- you are attemtping to pass a float that represents the average. The … | |
Re: Variable [b]sums[/b] in the second code snippet is being used before it has been initialized. Look on line 5: what is the initial value of sums.x? Answer: its unitialized and could contain any random value. So the initial result of line 5 is undefined because we don't know the value … | |
Re: You are attempting to stuff 3 bytes (string2) into a character array that is only 1 byte (string1). Try this: [code] [color=red]int[/color] main() { [color=red]char string1[4] = {0}[/color] char * string2 = "EL"; StrCpy(string1, string2); //cout << string1; //must output EL } [/code] | |
Re: I don't get it. How do you go from "40 20 ..." to "2 1 3 0" ? | |
Re: My guess is that in main.cpp, the Graph object has not been initiaized, so when ReadGraph() is called and attempts to delete arrayEdges, CRASH/COREDUMP. In main() initialize all Graph variables to 0 before calling ReadGraph() to see if that resolves your problem. [code] int main() { Graph g; memset(&g, 0, … | |
Re: Every line in a text file ends with '\n'. According to your instructions you would have to skip the last word of every line that is read. Lines do not have embedded '\n' characters. | |
Re: Can you use the functions in time.h? If you can, then just fill in a struct tm and call mktime() to calculate tomarrow [code] #include <time.h> ... int main() { int m = 11; // November int y = 2008; int d = 2; struct tm tm; // clear all … | |
Re: Assuming you are using MS-Windows, you will probably find something in one of these [URL="http://msdn.microsoft.com/en-us/library/ms534233(VS.85).aspx"]Font and Text Functions.[/URL] | |
Re: There is no such macro declared in windows.h. Maybe you mean [URL="http://msdn.microsoft.com/en-us/library/ms633548(VS.85).aspx"]SW_MAXIMIZE[/URL] ? If yes, then look in WinUser.h header file |
The End.