15,300 Posted Topics
Re: If you read the class description in Resistor.h you will notice that none of the three constructors takes 4 arguments. If you are not allowed to change that, then your only alternative is to change the lines in ResistorMain.cpp by removing one of the arguments so that they match the … | |
Re: If you use [icode]vector<int>[/icode] then you can use std::sort() to sort the numbers. [code] start of loop read a line split line into individual integers and put into vector call std::sort display values end of loop [/code] you can do the same with simple int array instead of vector, but … | |
Re: Fist of all, fscanf() will not give you "black cat" because it will stop reading the file when it encounters the first space, so all it will give you on the first iteration of that loop is "black". Your use of strtok() in this instance is unnecessary because the line … | |
Re: >>#define p printf >>#define s scanf Horrible misuse of macros. Don't be so lazy and just type out the word printf and scanf when needed. >>Link list strings stored rewrite this program The structure is incorrect. You need to add the star to the declaration making nbook a pointer so … | |
Re: There are several programs that could have been used -- [URL="http://www.cdw.com/shop/search/software-titles/autodesk-autocad.aspx?&cm_mmc=acquirgy-_-google-_-CDW+Co+Op+AutoCAD+Inventor+2-_-AutoCAD&AcquirgyID=Cpz6PcNW"]Autodisk AutoCAD[/URL] is among the 15-20 programs. ![]() | |
Re: TCHAR is a macro -- you can't convert System::String to a macro, it doesn't make any sense. You can convert it to char* or wchar_t*, depending on whether you are compiling for UNICODE or not, but can't convert it to a macro. See [URL="http://msdn.microsoft.com/en-us/library/system.string_methods.aspx"]ToCharArray() here[/URL] | |
Re: how big is he file? maybe you should zip it up then attach that. | |
Re: You may need to rearrange your program a bit, removing the if-then-else statemet. [code] beginning of loop ask for user input if input is valid then exit the loop display error message end of loop display message that input is valid [/code] | |
Re: Do you have antivirus and antispyware programs running on the computer? If not then you need to get them. | |
Re: Rebuilding DaniWeb is not an option. Ms Dani is in the middle of a major upgrade. Use code tags to make it retain formatting [noparse][code] // your stuff goes here [/code] [/noparse] If that doesn't work for you then you can just take a screenshot of your computer and attach … | |
Re: I see the same behavior using vc++ 2010 express on 64-bit Windows 7. The memory eventually went back down to normal level after a couple minutes. I think the problem is that the program does not release memory back to the operating system so that Task Manager can see it, … | |
![]() | Re: Post actual code that illustrates the problem. |
Re: >> I get an error that says "cannot instantiate an abstract class" even though it is instantiated in a .cpp. Classes that contain pure virtual functions can not be instantiated o their own -- inherited class must implement the function and the inherited class must be instantiated. SubdomainPart is not … | |
Re: First of all you don't have to repeat [b]private[/b] before each object. The access modifier is good until you change it to something else [code] class date { private: int day; int month; int year; }; [/code] Next, you need to provide the three public constructors that are in your … | |
Re: Maybe you are confusing EOF with end-of-string NULL terminators? The last character of a standard C or C++ string is '\0', which is called a NULL terminator. | |
Re: why not just create your own web site where you can store anything you want on the file system. This would also eliminate the possibility that anyone on the internet can view the files -- your files could be much more secure from the public. | |
Re: The derived class just calls the base classes public member functions, they can not change the value of private member data objects or call private functions. | |
Re: [URL="http://www.fileformat.info/info/unicode/utf8.htm"]Here[/URL] is an explanation of utf8 file format. Note that the first two bytes may be a binary integer -- see the chart at the end of that link. | |
Re: >>if( line.find( keyword ) ){ Should be this: [icode] if( line.find( keyword ) != string::npos ){[/icode] >>how to input a way of tracking line numbers. Just add an integer to count the lines as they are read. Something like this: [code] int linecount = 0; ... cout << "line: " … | |
Re: There will be no arks since its the end of the world. The end will come due to our sun exploding or collision with an asteroid, not because of a flood. | |
Re: wouldn't it be a lot easier to just check if the string contains @ and a period? Seems like regex is overkill for this application. | |
Re: Is [URL="http://technetsrilanka.net/blogs/bubble/archive/2011/01/01/microsoft-multiport-server-2011-beta-availability.aspx"]this[/URL] an example of what you are talking about? | |
Re: [code] int odd = 0; int even = 0; // now prompt for some values not shown here // I'll leave that up for you to figure out. // print the values printf("odd = %d, even = %d\n", odd,even); [/code] | |
Re: 'A' - 'P' results in a negative number. rand() % 16 + 'A' or rand() % ('P' - 'A') + 'A'; | |
Re: Real programmers don't need Intellisense because they have memorized the syntax or know how to read the docuomentation and all that does is slow them down :) | |
Re: how to do it will depend on the operating system and possibly the compiler you are using. | |
Re: [QUOTE=gerard4143;1778428]If you really need to jump all over your program try a safe function like longjmp(). [code] void longjmp (jmp_buf env, int val); int setjmp ( jmp_buf env ); [/code][/QUOTE] Wrong. longjmp() and setjmp() are not supported in c++ program. I have used goto on very very rare occasion when … | |
Re: That's because you have to either add a call to keyboard input so that the program waits for you to press a key, or run it in its own cmd window. | |
Re: You are passing item objects to those functions by value instead of by reference. change the function parameter list to use reference & operator so that the item struct will retain its value when control is returned to main() | |
Re: Did't you click the "Buy Now" link? | |
Re: line 31: Never ever for any reason call main() from any part of a program. In the example you posted use a loop. line 23: what is cls? That line doesn't make any since at all. | |
Re: Why would you want to do that? Just use Code::Blocks and you have it done, and probably much better too. And Code::Blocks contains a debugger, which Notepad++ does not. | |
Re: Can't answer your question until I see your program. Why do you need to recompile just to choose another option? All you have to do is prompt for the option number and run a switch statement for the option. If you want to choose another option just put all that … | |
Re: | is a bit operator. See [URL="http://www.cprogramming.com/tutorial/bitwise_operators.html"]this tutorial[/URL] | |
Re: Call fgets() to read entire lines of a file [code] char line[255] = {0}; myfile=fopen("garrudaRanch.txt ","r+"); if( myfile != NULL) { while( fgets(line, sizeof(line), myfile ) { // do something } fclose(myfile); } [/code] | |
Re: Yes, that is odd using true to indicate the number of elements in an array. true is used for boolean operations, such as true or false, and you can't count on true being equal to 1, it could be -1 in some implementations. Another point -- get rid of all … | |
Re: Your program is missing some header files that your compiler should have complained about. For example, va_start is undefined because you failed to include the header file that defines it. Learn to use google to find out where va_start is declared. You will save yourself an awful lot of time … | |
Re: >>Now the next part of my plan is a way to convert this char* representation of a pointer which will be passed in, to the actual numeric value of it. Forget that idea, it won't, and can't work for reasons previously given. Pointers can not be passed between processes because … | |
Re: The second program is wrong because line 8 is not passing a pointer to pointer, but pointer to pointer to pointer, which means that function pointer should have three stars, not two. | |
Re: It is customary to have program options to start with either - or /, such as -key or /key. Sometimes you may want an option to be something like "-key=Something", and you may also want to allow for spaces within the string, for example you may type on the commandline … | |
Re: In MS-Windows WaitForSingleObject() you can specify a time limit for the lock to happen. | |
Re: Deposit $1Million USD in my PayPal account and I'll gladly do your homework for you. Otherwise, if you can't or won't do that, then post the code you have so far and we'll talking about the problems you are having. | |
Re: 1) It shouldn't matter if the length of the search string is the same as the replacement string. When the search string is found, copy the original string up to the beginning of the search string, then append the destination string, finally move the pointer past the end of the … | |
Re: 1. Change four functions in fairy.h to pure virtual functions and remove the corresponding functions from fairy.cpp. You will also have to declare the same functions in each of the other header files as just virtual. [code] // fairy.h virtual void askForWish() = 0; virtual void helpFairy() = 0; virtual … | |
Re: >>so i can skip the "int strSize = sizeof(str);" in every function. Just as well because sizeof does not return the length of the buffer, only the size of a pointer (which on 32-bit compilers is 4). What you will probably have to do is pass the size of the … | |
Re: The parentheses are used to tell the compiler that the code inside is a typecast, which changes the datatype of variable msg from void* to class1*. | |
Re: >>c--; The initial value of c is too large. The value of argc is the number of strings in the array. So it counts from 0 to argc-1. You should make the loop as you would when using any other array [code] for(int i = 0; i < argc; i++) … | |
Re: In a program? None. makefiles are not used by programs, they tell the compiler how to compile the program. | |
Re: [URL="http://msdn.microsoft.com/en-us/library/a6cskb49(v=vs.80).aspx"]See this thread[/URL] for how to code managed enumerations. There should be no colon after the word public. |
The End.