15,300 Posted Topics
Re: Q1: do you know what 2! and 4! mean and how to calculate them with pencil & paper? If not then you need to study factorials, which are used in statistics. Q3: do it just like you would numbers. Lets say you have three characters 'C', 'A' and 'Z'. Which … | |
Re: I found them annoying at first, but I've gotten use to them. The last post in the thread would be more useful, but too time consuming to implement. | |
Re: >>I don't quite know "what to return" from this block of code It means that function must return something. You need to add [icode]return input;[/icode] on line 29 or the first code you posted. | |
Re: how big is [b]number[/b] ? Is [b]array_size[/b] the number of valid elements in the array? If that is true then line 9 is wrong because there is no such element as number[array_size] -- should be number[array_size-1] why is that reading the file one character at a time? The >> will … | |
Re: jamthwee is right -- in order to change something in a text file you have to rewrite the entire file, making whatever changes you want while writing the file. Calling seekg() does nothing to help you with that. If the current password is "abc" and the new password is "abcdefg" … | |
Re: If those are two different problems then please start a new thread for each problem. Tossing them all together into the same thread makes it almost impossible for others to answer without a lot of confusion | |
Re: char* is a pointer which can be made to point to most anything, while I guess you mean std::string c++ class. | |
Re: [QUOTE=techno t;555437]Unfortunately the more difficult ones I struggle to read, lol so it's a balance really *[/QUOTE] I agree, Sometimes I get frustrated at not being able to successfully type the right characters and just leave with web site. Result: they just lost a member. | |
Re: try this slightly modified version of your program. In both cases you can only enter 19 characters, not 20, because the 20th byte is reserved for the string's null teriminator -- 0. [code=cplusplus] int main() { char getdata; cout << "Enter one character: "; cin >> getdata; cin.get(); char line[20] … | |
Re: >>But know how I can access to my values in array Is that the question -- how to extract each of the numbers in the string ? extract them using sscanf(). There is a simple example [code] int main() { char line[] = "123 234.56 789"; int a, b; float … | |
Re: how about using something like PcAnywhere or Hummingbird ? | |
Re: knewc: line 20: you can't reverse the string using the same charcter array as the original string. You need to use a second array. That's the purpose of [b]new_string[/b]. And use the = operator, not +=. >>i could do this with my hands tied behind my back and plunk it … | |
Re: [URL="http://www.cs.cf.ac.uk/Dave/C/node27.html"]Here [/URL]are some examples | |
Re: Return values are normally passed back in registers -- its standard practice to put a 16-bit int (short in C) in AX, 32-bit in EAX or DX::AX and 64-bit on EDX::EAX. But you can do it anyway you want. pointers to arrays etc are done the same way. If those … | |
Re: You probably need to read a [URL="http://home.netcom.com/~tjensen/ptr/pointers.htm"]pointer tutorial[/URL] to find out what pointers are and how to use them. | |
Re: If you have a choice of GUI then I would probably start with [URL="http://www.opengl.org/documentation/"]OpenGL[/URL] because its free, portable and has a lot of support for questions etc. | |
Re: [URL="http://www.cprogramming.com/tutorial/lesson14.html"]tutorial here[/URL] | |
Re: certainly we can help, afterall that's what DaniWeb is all about :) Post the requirements and what you have done to solve it, along with compiler error messages and/or your questions. | |
Re: do you know how to open a file and read each line? hint: ifstream and getline() | |
Re: I don't really know anything about that raw_open() function, but from [URL="http://msdn2.microsoft.com/en-us/library/ms527302(EXCHG.10).aspx"]this vb example[/URL] the parameters are supposed to be of type _variant_t, not BSTR. | |
Re: 1) limits.h has CHAR_BIT that defines the number of bits in a byte for your machine. Just find the file size and multiply by CHAR_BIT. 2) This wants two answers -- convert KB to bytes by multiplying by 1024, then divide that answer by the number bytes per second to … | |
Re: post your code so we can help you. We are not here to help you cheat at school. | |
Re: Use windows explorer to check the location of the input file -- it probably isn't in the folder you think it is. If no path is given the file must be in the same folder as the executable program. And the output file will also be written to the same … | |
Re: line 31: that is calling GetRadius() ok but throwing away its return value. [icode]flat radius = Sweet.GetRadius();[/icode] Other similar lines have the same problem. line 45: endl only works with cout. lines 54 and 68: those functions must return some value even if it fails the validation. return 0 would … | |
Re: 1) [icode]Sleep(60*1000);[/icode] -- MS-Windows, *nix is the same except use sleep(60) instead of Sleep() 2) best to write the last time to some external file, such as the registry or a file, so that your program can continue to do other things during that lengthly time. Then once each hour … | |
Re: line 8: should be [icode]const int capacity[/icode] line 9: you need to initialize all the bytes of the array with 0 so that they contain a known value [icode]char letter[capacity] = {0};[/icode] line 17: >>char letter[] = {A}; That is incorrect -- shold probably be [icode]letter[pax] = 'A';[/icode] What it … | |
Re: [code] char type[sizeof(int)]; memcpy(type, (char *)&numtype, sizeof(int)); [/code] | |
Re: you are doing integer math and you need to do floating point math [code] int a = 2; int b = 3; int c = 2; float result = (float)(a+b+c)/3.0F [/code] | |
Re: Encryption only keeps the casual observers out -- professional hackers will break the encryption algorithm pretty easily. There has never ever been an encryption algorithm that has not been broken by someone, even the algorithms used by military can be broken given enough time and effort and is why they … | |
Re: [code] int main() { cout << (int)'£' << "\n"; return 0; } [/code] The output of the above on my computer is -93. You'll have to change the local setting if you want to print that character from -93 because it doesn't print that with the standard american local setting. | |
Re: >>Does anyone know if there is someway to write something harmless to \\.\PhysicalDrive0 Nope. There is nothing [b]harmless[/b] about writing anything to a drive. It is always a destrictive write (meaning it destroys whatever was written there before). | |
Re: by [b]vector[/b] do you mean a character array ? Such as [icode]char data[255];[/icode] Use the FILE and associated functions located in stdio.h to read and write files. [URL="http://www.cprogramming.com/tutorial/cfileio.html"]Here[/URL] is a tutorial. | |
Re: If you are passing smath to a function then you will also have to pass the number of elelemts, because there is no way for the function to get the number of elements from just a pointer. sizeof(any pointer here) in 32-bit compilers is always 4. sizeof(struct math) is 8. … | |
Re: >>which is the best way to sort the numbers at the end - use <algorithm> with sort, or do some loop to sort them? Depends on whether you need to write your own sort algorithm or not. If you instructor doesn't care then I'd use std::sort because its much simpler. … | |
Re: why is Student.Major and integer ? why not a string to that you can enter CS (computer science) or any other major ? VC++ 2008 Express runs without errors too. But that doesn't mean there are no errors in the program. Actually there are several errors -- buffer overruns. For … | |
Re: you have to allocate space to temp before doing that. You need length of chars1 + length of chars2 + 1 number of bytes [icode]temp = new char[strlen(chars1) + strlen(chars2) + 1];[/icode] | |
Re: Nice commercial :) Hope they got permission to use that theme and film clips. | |
Re: sort the lines just like you would sort any other set of strings, but instead of comparing the strings first find the first tab in the line and compare the strings up to that position [code] #include <iostream> #include <string> #include <algorithm> #include <vector> using namespace std; struct SAscendingDateSort { … | |
Re: any particular reason to use a hash? A simple linked list of structures would do the job. When done reading just sort the list by frequency and you're done. | |
Re: >>...is that ok? No. | |
Re: My guess is that you do not have the list of directories set up correctly in the compiler IDE. Look at menu Tools --> Options --> Project and Solutions --> C++ Directories and make sure the path to the include directories are correct and includes the path to where you … | |
Re: Did you try to compile it? Or are you allowed to do that? Read the line one at a time, pay close attention to spelling and variable initialization. I can spot three mistakes right away. | |
Re: You have at least two choices: 1) Use ClassWizard to give the edit control a variable name. Menu View --> Class Wizzard, elect the control id then [b]Add Variable[/b]. For an edit control that will create a CString object which will be filled when UpdateData(TRUE) is called. 2) Get the … | |
Re: [URL="http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/language/ref/clrc07cplr237.htm"]Here [/URL]is an explaination of default parameter values. That link talks about exactly what you are trying to do. | |
Re: >>PLEASE HELP ME!!!!! help you do what? does your program compile ? (hint: no it does not). what errors does your compiler produce? [code] if(txt.find(a)!=txt.end()) { cout<< } [/code] Above is incomplete statement. | |
Re: you can try something like this: But your tempValue buffer may not be large enough, depending on the length of the string. Should be at least string length * 7, maybe larger. [code] char temp[16]; tempValue[0] = 0; // put below in a loop for each character sprintf(temp,"0x%04X, ", Buffer[i]); … | |
Re: its totally up to the compiler whether it honors the inline keyword or not, and there is no way to force the compiler to do it one way or the other, except maybe make the inline code a macro. | |
Re: you could resort to C's stricmp(), or for some compilers, comparenocase() to make case-insensive comparisons [icode]if( stricmp(element.c_str(),Institute[m].c_str()) == 0) [/icode] There is also c++ std::transform() that you could use to convert the strings to either all upper or lower case before comparison, but its a lot more ugly to read … | |
| |
Re: It isn't necessary for you to manually put all those line numbers in your code -- the code tags will do that for you. [quote=Salem] This tells you to use code tags - [url]http://www.daniweb.com/forums/forum2.html[/url] So does this - [url]http://www.daniweb.com/forums/forum8.html[/url] Wait for it, wait for it - [url]http://www.daniweb.com/forums/announcement8-3.html[/url] You're not going … |
The End.