- Strength to Increase Rep
- +9
- Strength to Decrease Rep
- -2
- Upvotes Received
- 21
- Posts with Upvotes
- 20
- Upvoting Members
- 14
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: The short answer is that you can't. The system() function (it's not a command) supported by win32 compilers/libraries starts up a command shell, and that command shell shows the "black command prompt window". If you actually need a command shell (eg you're running an inbuilt shell command or executing a … | |
Re: TButton's constructor needs to be passed a pointer to a TComponent (eg a parent form) that is responsible for managing the button. It is also necessary to set various attributes: position, caption, visibility, the function to be called when the newly created button is created, etc etc. TButton is derived … | |
Re: [QUOTE=Narue;715451][1] I can't say I've succeeded, but that's my goal.[/QUOTE] All good authors start with that goal. Very few fully achieve it, unless they simply finish off work started by someone else. The journey towards the goal, and products produced along the way, are actually what's important in the long … | |
Re: Firstly, your iterative versions aren't equivalent either: your iterate over a different interval in the loop. As to the differences with the recursive versions, there are all sorts of possible explanations. 1) The way you're measuring time may have different granularity. The clock time is not infinite resolution - hence … | |
Re: Not even close. Your code does not insert any characters into the string array. What is the purpose of the "input" argument supplied to the function? where is the codes counting the number of characters read (or inserted into a string)? Where is code to make it terminate at whitespace? … | |
Re: [QUOTE=Aia;714931][QUOTE=Sci@phy;714926]The only reason this code should give you error is if you input something else that float, let's say letter [...] [/quote]scanf() would return an EOF in that case.[/QUOTE] No it will not. It will return zero in that case. EOF is only returned upon reaching end of input. If … | |
Re: [QUOTE=s0me1;690339]I'm not an expert, but I was reading this article: [url]http://www.icce.rug.nl/docs/cplusplus/cplusplus09.html#l153[/url] Apparently, if you overloaded the operator delete like this: void operator delete[](void *p, size_t size); the parameter "size" will tell you how long the array is. However, if you want the normal delete[], you'll have to write "::delete[]"[/QUOTE] Curiously, … | |
Re: Instead of [code] while ( !indata.eof() ) { indata >> EmployeeInfo[employee_count].set_first_name(); cout << EmployeeInfo[employee_count].get_first_name(); // etc } [/code] try doing this; [code] string temp; while ( !indata.eof() && employee_count < MAX_EMPLOYEE_SIZE) { indata >> temp; EmployeeInfo[employee_count].set_first_name(temp); cout << EmployeeInfo[employee_count].get_first_name(); // etc } [/code] The additional check of employee_count stops running … | |
Re: [QUOTE=cutedipti;702575]Hi, But, when we define any character array as char a[3]={'a','b'}; then compiler here automatically consider '\0' null character to represent the end of the string [/quote] That's not true. You have explicitly initialised two elements of three-element array. The standards go about it in a round-about way (there's a … | |
Re: As a matter of fact, your code isn't valid C either. If you are going to ask for help in converting C code to C++, it helps if you post [u]working[/u] C code. You need to read [URL=http://www.daniweb.com/forums/thread78223.html]this thread[/URL] before posting again. | |
Re: Firstly, there is no space between the closing bracket at the end of FOR(x,n) and preceding the rest. That's a stylistic concern, but badly hurts readability. Second, and more significantly, typeof() is not a standard function or operator in C++. It is an extension specific to g++ (GNU c++) in … | |
Re: Try closing outputfile before attempting to open it as an input file. | |
Re: [QUOTE=devnar;715348][icode]string[i]=getchar();[/icode] I might be wrong though. Feel free to correct me. :)[/QUOTE] You're wrong. getchar() does not behave in quite the way you described. Consider yourself corrected. Salem is right. Once you get past the concern he pointed out, there are also additional problems that the code has no error … | |
Re: You're asking the wrong question. The compiler will attempt to invoke a copy constructor (assuming one exists) upon any attempt to create a copy of an object. The real practical concern is whether you need to write the copy constructor yourself or let the compiler do it for you. If … | |
Re: [QUOTE=williamhemsworth;759433]In one of my classes, there is one person named James Bond, and you can noticeably see how it affects his life (not in a good way). [/QUOTE] Naming a child James Bond is actually defendable: there were families named Bond for several generations who had a long-standing tradition of … | |
Re: 1) Get rid of the values array that is declared in biggest .... work with the array a that is passed instead (use a and count, rather than values and SIZE in the loop). Otherwise, biggest() will only ever find the largest value of that particular array. 2) You need … | |
| Re: break statements can be used in looping constructs, and in switch/case blocks. They cannot be used to break out of an "if" block, or as an alternative means of returning from a function. Also, <iostream.h> is non-standard. #include <iostream> instead. |
Re: You're using the function; presumably you can work out which header it came from. close() is not a standard function in C or C++. I'm guessing it is a function related to sockets handling under win32 or unix (typically in a header like <io.h>, but that varies). If my guess … | |
Re: You're developing a realtime application, and don't know how to add values to elements of an array????? Pull my other leg: it'll play a tune for you. What is the criterion by which you would describe a method as "best"? If you are truly designing a realtime application, you will … | |
Re: [QUOTE=Bladtman242;776813]can i just change those values? either just by editing limits.h or by changing the value for a specific program? or can i make a variable of unlimmited size? [/QUOTE] Generally, you cannot. The contents of limits.h generally reflects technical limits on capability of your compiler on your target operating … | |
Re: [QUOTE=Phil++;777683][CODE] switch (choice) { case 'p' || 'P': // do this break; case 's' || 'S': // do that } [/CODE] won't work[/QUOTE] Indeed. 'p' || 'P' would expand to a bool value of true, as will 's' || 'S'. Compilers will generally refuse to compile the above, as particular … | |
Re: If n is 1, then the set is {0, 1}. If you have a set for n, the set for n+1 can be generated by appending a 0 and then a 1 to all elements of the set n. For example, the set for n = 2 will be 0 … | |
Re: A common way of return multiple values is by returning a struct which has multiple members, or for the function to accept a pointer that receives additional data from the function. You don't actually need to return multiple values though: return 0 if there is no operation, '*' if multiplication … | |
Re: The whole point of Dijkstra's algorithm is to find a least cost (or shortest, in your case) path. Once you have a first path, eliminate one of the nodes (C2, C5, or C10 in your example) on that path from the graph, and run Dijkstra's algorithm again. If the resultant … | |
Re: [QUOTE=winrawr;776108]Should I avoid casting between data types? [/quote] As a general rule, yes you should. [QUOTE=winrawr;776108] I haven't really seen much about the use of this, but it seems like one of those last-minute-no-way-around kind of methods... but, for example, how would I use the length of a string in … | |
Re: Try this. Comments added explaining the reason for change from your code. [code] #include <iostream> // <iostream> is standard, <iostream.h> is not #include <cstring> // need functions to work with C strings using namespace std; class Dummy{ char Name[256]; public: [color="RED"]// for main() to use a member function, it must … | |
Re: My guess is that IMG_GetError() is throwing an exception. However, it's hard to say, as you haven't provided a complete example. You've paraphrased where your think the problem is. Try providing a small but complete example that illustrates your problem (with a main() function, and everything someone else would need … | |
Re: [QUOTE=prashanth s j;766955]Hi having void ** worked, I had to typecast the &outputbuffer to void **. [/QUOTE] Maybe so, but that doesn't make it a good idea. If your function assigns *outputbuffer to something to something that is not a char *, and then main() dereferences it, the result is … | |
Re: [QUOTE=firstPerson;771044]I might think the pythagorean therom would be better easier to use than trig.[/QUOTE] You're making a distinction that doesn't exist. The Pythagorean Theorem [u]is[/u] basic trigonometry. | |
Re: The cleaning lady? Seriously, it is necessary to assume the houses are ordered 1-5 (first to fifth) from left to right. Then a bit of persistence with eliminating anything that contradicts any statement, but it's not that hard. Basic application of Occam's razor: eliminate the impossible, and only the possible … |