193 Posted Topics
Re: Perhaps this may help ? [URL="http://en.wikipedia.org/wiki/Wikipedia:Algorithms_on_Wikipedia"]here[/URL] :) | |
Re: There are a several ways to return a string to a calling function. You can use char* or the C++ string class. I would recommend: [icode] int foo(char* myString){ strcpy(myString,"www"); return 0; }[/icode] [icode] int foo(string& myString){ myString = "www"; return 0; } [/icode] You can also do [icode] char* … | |
Re: What Operating System are you on ? If you are on Unix or Linux then look up the kill() system call [URL="http://www.opengroup.org/onlinepubs/009695399/functions/kill.html"]here[/URL] | |
Re: The getline function for the istream class returns the line in a char[] istream& getline (char* s, streamsize n ); istream& getline (char* s, streamsize n, char delim ); There is another getline for the string class which returns the array in a string. istream& getline( istream& is, string& s, … | |
Re: Firstly the line feed or the new line character is '\n' not '/n'. By default most records in a file on Windows are terminated by the CRLF (\r\n) ie, the carriage return and line feed. On *nix, its just the LF (line feed character) '\n'. If you are uploading both … | |
Re: well your main function should be [icode] int main(){ return 0; } [/icode] Also EOF is a reserved macro. So call yours something else like "NEWLINE" or such. | |
Re: One of your issues is that your variables are static. So the scope of the variable is at a class level, not at an object level. Hence you will probably need to initialize it outside your constructor. In order to access a static variable, at the class level using the … | |
Re: See [URL="http://www.cppreference.com/wiki/stl/algorithm/max_element"]http://www.cppreference.com/wiki/stl/algorithm/max_element[/URL] | |
Re: Your tax rate for each year will be something like: YearlyTaxRate = intial_cost * tax_rate; Your current code states [icode] tax_rate = ? * initial_cost; total = initial_cost + electric_bill + water_sewer + tax_rate; [/icode] tax_rate is the variable where you are storing the user input. So define another variable … | |
Re: You will need to save the atomic weights for each element. For instance double OxygenAtom = 15.994 Then compute the total atomic weight for each element depending on the number of atoms, and then the average. double TotalOxygenAtomWeight = OxygenAtom * O Then compute TotalAtomicWeight and TotalNumberofAtoms. Your average weight … | |
Re: You open your input file. Read it until the end of the file. Close it. Set file pointer to stdin and keep reading until the user inputs exit. They are two separate input sources and have to be handled one after the other. Batch File description [URL="http://en.wikipedia.org/wiki/Batch_file"]here[/URL] | |
Re: You need an array that will store both your total quantity and the corresponding total price for that quantity. You have 5 items in all and each item has a total quantity and a total price. Edit: My mistake earlier. Your qty is an int and your price is a … | |
Re: I don't get it .... Why are you overwriting your password with the clue in change() ? [icode] strcpy(password,clue); [/icode] and why are you calling compare() from change even when the user does not enter a password .. coz then you have nothing to compare really ? | |
Re: hmm ... and then n/n! = n/n*(n -1 )! = 1/(n-1)! | |
Re: FYI .. void main() is never to be used ! It should [B][I]always[/I][/B] be [CODE] int main(){ return 0; } [/CODE] See [URL="http://users.aber.ac.uk/auj/voidmain.shtml"]here[/URL] | |
Re: It looks like pseudocode. You really want to translate this into C++ , write the whole program and see what you get. | |
Re: I am not so sure that its a good idea to in terms of OO to do this, but here goes .. Basically what you want is to add a function say void ChangeNumber(int index, int value) to your base class, where index is the position in the vector and … | |
Re: Basically you will compare the strings character by character. So start with comparing "A" to "J", since J is higher up than A, "John" is lexicographically larger. | |
Re: Here is your prototype for getName: char* getName() { return name; } So you need : temp = currnode->contact->getName(); | |
Re: Have you looked at the function fcvt ... see [URL="http://linux.about.com/library/cmd/blcmdl3_fcvt.htm"]here[/URL]. On windows its _fcvt_s [URL="http://msdn.microsoft.com/en-us/library/ty40w2f3(VS.80).aspx"]here[/URL] And you can always use sprintf .. its slower but reliable. | |
Re: Ok, first of all ... you CANNOT define your main function this way. Read [URL="http://en.wikipedia.org/wiki/Main_function_(programming)"]this[/URL]. Its either [icode] int main(){ return 0; } [/icode] or [icode] int main(int argc, char* argv[]){ return 0; } [/icode] You need to allocate space to your int array Value and then pass it in. … | |
Re: If you did the ftp in ASCII mode, your \r\n would be converted to \n on *nix. Another option to do it, if your file is not really large is just open the file in vi and then do a global search and replace by typing ":%s/Ctrl-VM//g" The Ctrl-V gives … | |
Re: Please post some code so that we can see what you have worked on until now. Check the forum rules [URL="http://www.daniweb.com/forums/announcement8-2.html"]here[/URL] Also [URL="http://www.mattjustice.com/cnotes/c_fileio.html"]here[/URL] is a C File I/O tutorial to help you get started. | |
Re: You might need to clear any set flags before you try to use the same file pointer "conFile" to access the second file. ie [CODE] if (!conFile){ conFile.clear(); conFile.open("code/constants.h", ios::in); } [/CODE] | |
Re: You should open the file as ios::binary. There is really no way to directly read in bits. You have to read in the bytes and then write a function to read the bits from a byte. | |
Re: hmm .. please read [URL="http://www.daniweb.com/forums/announcement8-2.html"]this[/URL] | |
Re: You could use char** as the return type, and pass in an integer pointer that will hold the total number of strings that you return to the calling function. for example: [code] char** foo (int* nStrings, ....) [/code] | |
Re: The shell is basically a program that takes your keyboard input, usually at a command prompt and gives it to the operating system to process it. You can also put shell commands into a file and execute it using "sh filename". There are different types of shells csh, ksh, bash. … | |
Hi, I am trying to find the header file monetary.h and the function strfmon() to do some currency conversions, but Visual Studio 2005 compiler doesn't seem to support those. Does anyone know if there is an alternative function I can use ? Thanks a lot. | |
Re: You should be able to find a job in software development with a Masters in CS. I've understood over the the period of my education that it helps to try and get your first job through campus interviews because that is the easiest way and that is the only way … | |
Re: One way to do it, also assuming know how many instances of it you want to run, is in a loop, start the process in the background. [CODE]while (x < counter){ ./process& x++; }[/CODE] | |
Re: Hmm, I think the problem may be that your class definition is missing a ";" at the end. | |
Re: The AIX native C compiler does not like the // comment style for .c files, since its considers it a C++ comment and not a C style comment. I think that is probably the reason you're getting the errors and you will either need to change it to the /* … | |
Re: I think you need to put braces around your if statements. Otherwise its always going to read in the eurosdollars variable. Its a good practice put braces around the body of the condition, even if its one line. [CODE] if (currency==1){ cout<<"Please enter the Dollars you would like to convert … | |
Hello, I looked for this on the forums, and found an invalid link to a tutorial. But I'd appreciate it very much if someone can point me to a tutorial on hash tables, that includes a basic implementation in C or C++. Thanks a lot. | |
Re: I am not sure if this is needed or not, but most CSV files have a header record, which is essentially the names of the columns separated by commas. If you are parsing an actual CSV file, you will need to take that into account also. | |
Re: With bash if you are typing on the command line you can just type $ expr 2 + 4 6 If you are putting it in a file, you can do #! /bin/bash expr 2 + 4 var=`expr 2 + 4` echo $var and it will print: 6 6 | |
Re: This is a basic bash scripting tutorial [URL="http://www.linuxcommand.org/writing_shell_scripts.php"]http://www.linuxcommand.org/writing_shell_scripts.php[/URL] I found which is quite helpful, and takes you through simple scripting step by step. This explains shell commands and how to write simple scripts. I would also recommend a tutorial on regular expressions if you are not familiar with those, since … | |
Re: This is interesting, and I was able to solve it using a couple of passes with pipes. For me its just easier to break it up into the steps that you explained and go through them one by one, and use temp files if needed. You can use a combination … | |
Hello, I need to figure out the sizes of different data types in a bash script. I haven't been able to make it work with sizeof(), is there an alternative ? Thanks a lot. | |
Re: The scanf() function is defined correctly. scanf basically is used to read input from stdin according to the format specified. The format can consist of control characters which are %d %s %f and so forth. All control characters must be preceeded by a % in both printf and scanf. The … | |
Hi Everyone, I just wanted to introduce myself. I am a sw developer, work mostly with C, but there is so much that I still don't know ... hence the name :) . I came across DaniWeb while trying to learn how to do time complexity of algorithms. Its been … |
The End.