15,300 Posted Topics
Re: Assuming there are other lines in the file that have other tags at the beginning of the line, I would use getline() to read the entire line, then use stringstream to split it up into words. If you just use >> operator you won't know the difference between lines -- … | |
Re: In DisplayData() you need a loop [icode]for(int i = 0; i < NUM_STU; i++)[/icode]. Then within that loop diaply the loop counter followed by each array value [code] cout << i+1 << " " << student_avg[i] << " "; for(int j = 0; j < NUM_QUIZ; j++) cout << matrix[i][j] … | |
Re: You can use some non-standard functions found in conio.h, assuming your compiler supports them. [code] time_t t1 = time(0); time_t t2 = t1 + 60; // one minute timeout while( !_kbhit() && t1 < t2) { // do count-down timer Sleep(100); // delay 100 milliseconds t1 = time(0); } if( … | |
Re: I want absolute silence. Trying to write code while listening to anything is just too distracting because I tend to listen to music and not pay attention to what I'm coding. Its a little like trying to code while intoxicated. Can't be successfully done. | |
Re: I don't know how to initialize it, but try this and your solution doesn't work. My suggestion is not to put const variables inside structures. It wouldn't make any sense to put them inside a structure anyway because by definition you set a const variable to a single value which … | |
Re: When you pull the rug out from under an executing program there is no guarentee that the operating system can kill the process cleanly. Using that taskkill.exe should be a last resort. | |
Re: I'm from USA -- we don't play the game here, so I'll bet on England because I lived thee 3 years in 1980s when Iron Lady was PM. | |
Re: line 92: isdigit is a macro that returns a bool value (true or false, 1 or 0) You can not compare it with a value as you have tried to do in that line. Other errors I found are just careless errors, such as misspelled function names. Check the error … | |
Re: You don't need a switch statement for that. objectclass* objects = new objectclass[numberfobjects]; or use a vector of objects vector<objectclass> objects; objects.resize(numberofobjects); | |
Re: just include <list> header file. [URL="http://www.sgi.com/tech/stl/List.html"]See this link[/URL] [code] #include <list> using std::list int main() { list<int> MyList; } [/code] | |
| |
Re: Maybe you are doing it wrong. [quote=Wiki] DirectDraw is used to render graphics in applications where top performance is important [/quote] I don't use DirectDraw so I don't know if that's really true or not. [URL="http://en.wikipedia.org/wiki/DirectDraw"]Here[/URL]'s the source of that quote. | |
Re: line 18 initializes all array elments to 0. Therefore, line 28 can never find one whose value is anything other than 0. When the loop is first entered, the value of counter is 0 and the value of studentGPA[0] is also 0. The next iteration of the loop the value … | |
Re: So, your program is trying to make 31,536,000 memory allocations (86400 X 365) ??? how much memory is being allocated at one time? Is any of the memory ever released? | |
Re: There are several ways to allocate arrays, here is just one of them. [code] int rows = 10; int cols = 2; int **arry = new int*[rows] for(int i = 0; i < rows; i++) arry[i] = new int[cols]; [/code] If you need all the memory to be in one … | |
I tried to write up a test program that uses std::copy and istream_iterator to copy one text file to another. But it doesn't work because the '\r' and '\n' in the file are lost. I've tried opening the input and output files in text mode and I've tried opening them … | |
Re: [URL="http://www.deitel.com/articles/cplusplus_tutorials/20060225/virtualBaseClass/"]use diamond inherentence[/URL] [code] class A { public: A() {x = 0;} protected: int x; /*Variables required by A, B, C and D */ /*functions required by B and C*/ }; class B : public A { }; class C : public A { }; class D : public B, … | |
Re: I have no clue. Where did you see that? Quote some of the surrounding text in which that appeared. | |
Re: When you say "injecting" do you mean LoadLibrary()? If not, then what exactly do you mean. | |
Re: your example is wrong. What about the two Ns in Bunny and the s's in Mississippi? DID THE BUNY GET THE MISISIPI MAPS FROM B One problem with that is there is no way to recreate the original sentence. In any event, you will have to show is what you … | |
Re: See his 24 Nov 2009 post -- with -2 rep. TheDude also got bad reped twice in this thread. Don't know if those are new or old reps. | |
Re: you could create an 18-byte character array, assuming 8 bits to the byte. Files do not contain bits -- they contain bytes, and the number of bits to the byte is operating system dependent. On MS-Windows and *nix there's 8 bit to the byte. So 128 bits would be 128/8 … | |
Re: scanf("%s" ...) stops reading keyboard input at the first space. So if you type "John Doe" all scanf() will return is "John". The word "Doe" will be left in the keyboard buffer, so the next time scanf() or gets() is called it will grab "Doe" and not let you type … | |
Re: The simplest way to write that program would be to use strtok() function. But if you are not permitted to use that, then you will just have to write your own. >>char *ptr[count+1]; C99 will not allow you to do that, but vuture versions of C may. For now you … | |
Re: The error message says it all -- you are trying to link together two *.obj files that contain the same function. | |
Re: All you have to do is swap the data item of the two nodes -- just like you would swap any two integers. And please use code tags the next time you post code so that people can read it. | |
Re: It took several years before I could write C code without use of a very good reference book next to my computer. I was constantly looking up functions and their parameters just to make sure I was coding it correctly. Then I learned to use debuggers and how to use … | |
Re: You mean something like this? [code] #include <stdio.h> #include <stdlib.h> #include <ctype.h> #pragma warning(disable: 4996) int main() { char line[] = "00 00 57 8B CB 89 5D"; unsigned char bytes[40] = {0}; char* ptr = strtok(line," "); int index = 0, i; char* end = 0; while(ptr != NULL) … | |
Re: This is a very simple program that should give you a little practice with reading and writing simple text files. You need to use ifstream for input file, and ofstream for output file. Then in a loop, read a number, square it, then write it out to the output file. … | |
Re: You can contribute to threads even if you don't know the answer to the original question. If you find a thread where someone answers it and you don't understand the answer, then go ahead and ask for more clarification about what you don't understand. But be careful here not to … | |
Re: If you only know part of the string then use enum windows, then in the callback function call GetWindowText. | |
Re: Thank you for spending many years in our military -- I for one know what that is like and am able to better appreciate the sacrifices you are making. As for that "high paying" job --- what do you consider to be high paying? And where? A bachelor's degree will … | |
Re: Best place to ask those questions is on the ITK's mailing list. Read the *.pdf file from [URL="http://www.itk.org/ITK/resources/software.html"]this link[/URL]. They are the experts, not us. | |
Re: No command. You have the write the code to do that yourself. Write down on a piece of paper the original string. Then using your pencil try to delete and insert the new text. Doing that visually may help you to understand more clearly how it might be done with … | |
Re: [QUOTE=VernonDozier;1514824]Consider the source. Your comment was completely on the mark and justified and you got down-voted precisely BECAUSE it was completely on the mark and justified. Upvoted from me as a counterbalance.[/QUOTE] Ditto | |
Re: >> Yes the program is open source but I dont wanna compile How do you expect to accomplish the goals you posted if you don't recompile the program???? :icon_eek: | |
I've seen this happen a couple of times recently, when I give positive rep the member's rep count seems to either not change or go down. See [URL="http://www.daniweb.com/software-development/cpp/threads/356693/1520030#post1520030"]this post[/URL] for example. Then look at the reps give in his profile page. The one I just gave him isn't there. Also … | |
Re: No one here will do your homework for you unless you want to pay some very big $$$. ![]() | |
Re: In C language the return value from malloc() does not need to be typecast at all. But if you do use typecast then it needs to be typecast to the appropriate type. For example the line 3 you posted the return value of malloc could not be typecast as char* … | |
Re: You're using the wrong compiler. What you have is old and buggy. Replace it with Code::Blocks, whieh is current . You will want the version that is supplied with MinGW compiler. | |
Re: You mean search programs similar to *nix grep? There already is a MS-Winows port of grep, which is adequate for all my needs. | |
Re: >>for(t=0; t<&numberOfThreads; t++) That is attempting to compare integer t with a pointer to numberOfThreads. Why the pointer? Remove the & pointer operator and it will be ok. line 60: void functions can not return a value. lines 63 and 64 are not inside any function. Format your code better … | |
Re: If you can't use c++ objects then use FILE* and call fgets() in a loop until end-of-file is reached, counting the number of iterations of the loop. When done, you will have the number of lines in the file. | |
Re: Depends on what you are talking about. [URL="http://support.microsoft.com/kb/178480"]Here[/URL] is one explanation. | |
Re: I assume you already know enough assembly language to at least start that project. Teachers don't just toss a project like that at on the first day of class. So, get started and post what you have done. You will probably want to write some pseudo code first so that … | |
[rant] Its so damed confusing and difficult to use. I spent three days trying to install something on my Fedora 11 machine that would take me no more than about 10 minutes in Vista (or any other version of MS-Windows). As an example: wxWidgets. I couldn't even successfully compile their … | |
Re: You have already done the hard part. What don't you understand about calculating the median? Just sort the array and select the value in the center of the array. There are many sorting algorithms, the easiest one (but also the slowest one) to code is the [URL="http://en.wikipedia.org/wiki/Bubble_sort"]bubble sort[/URL]. | |
>>Ok, so time() function (argument being null) returns what? It returns the number of seconds since 1970, as you previously posted. It doesn't matter whether the parameter is NULL or not, it will always return the same value. | |
Re: The only thing I find annoying is, when editing a post, having to use the mouse to move the focus to the "reason for editing" box. In previous versions of DaniWeb the tab key sent the focus to that box. I would think its just a simple matter of changing … | |
Re: It's bad coding to do what openRecords() is doing. The ifstream object should be declared in main then passed by reference to OpenRecord() [code] int main () { //Title cout << " Employee sales records.\n" << endl; //Get the file stream or quit if the records file is not found. … |
The End.