15,300 Posted Topics
Re: Welcome back. A lot has changed in the past week or so, so you might want to briefly look at some of the threads in DaniWeb Commnity Forum. | |
Re: >Why does including (float) make the difference? Because 1/2 is integer digision, and 1 divided by 2 is 0. Make it float in a couple ways: 1) 1.0F/2.0F or 2) (float)1/2, or 3) 1.0F/2, or 4) 1/2.0F. Any of those methods are ok, just a matter of personal preference. | |
Re: Your program worked perfectly for me using VC++ 2010 Express on Windows 7. since this is c++ code you don't need the typedef symbol. | |
Re: the easiest way to do it is to just copy everything from InputArray to OutputArray, then sort OutputArray. If you are allowed to use it you can copy the entire array with one line of code using memcpy() function. If you can't use that function then do the copy in … | |
Re: Dump that old ancient compiler and buggy IDE. Get either free VC++ 2010 Express or free Code::Blocks w/MinGW compiler. Both compilers will produce startup DLL projects for you. [Here is a tutorial](http://www.codeguru.com/cpp/cpp/cpp_mfc/tutorials/article.php/c9855/DLL-Tutorial-For-Beginners.htm) | |
Re: >m1[10][10] = rand() % 10; that is doing nothing but populating a single cell, which is NOT in the matrix, with a single random number. There is no such cell in that matrix. >if(r2==c1) Huh? What difference does it make if r2 is the same value as c1? r2 is … | |
Re: Not sure what you are trying to accomplish with that code, but the reason that you don't see all the data is probably due to those two if conditions. Remove them and just set each element to some random number. ~~~ for(i = 0; i < sizes; i++) { for(j … | |
Re: use fgets() instead of scanf() so that all the words get put into the string. ~~~ int main() { char line[100]; fgets(line, sizeof(line), stdin); } ~~~ | |
![]() | Re: The first thing I noticed is that this->name is an unallocated pointer (line 67, road.cpp). You have to allocate memory for it before you can call strcpy() in the second constructor. line 7, main.cpp: missing the third parameter to the constructor. |
Re: The easiest way to do the swap is to swap the data, not the node itself. If you do that then there is no problem with pointers because they won't be changed. When a node has a lot of data items it is easier to put them into a structure … | |
Re: In a loop, convert each byte to binary then add to an int accumulator, for example assume you have a character array named "msg" and a loop counter named "i" sum = (sum * 10) + msg[i] - '0'; | |
Re: You need to tell us about the problems you are having. Would you take your car to a repair shop and tell the people "my car is broke, please fix it". Of course not, you have to explain as best you can what's wrong with your car. Same here. We … | |
Re: You can easily check that if you just print out the contents of Packet_Request | |
Re: > GLubyte indices[]; Declare that as a pointer and allocate memory for it on line 35, after you know how big it should be. >void createGeo(geo inst) Pass that object by reference, not by value. such as void createGeo(geo& inst)so that any changes made by createGeo() are reflected in the … | |
Re: The number 48 is for the character '0' (zero), google for "ascii chart" and you will get a complete list. In the code you posted the -48 is converting a charcter digit '0' to '9' to binary, by subtracting '0' from it. | |
Re: exactly like you would any array of objects, such as an array of its. Note that the first two parameters of the format string need to be %s, not %c because %c only allows entry of a single character while %s allows entry of an entire word. You should also … | |
Re: When I create a new thread will I have a list of check boxes that I can select which forum(s) apply? That sounds like it could get very confusion real quick. What if someone just checks them all?? If I respond to a thread in one of the forums is … ![]() | |
I tried using [code] and [/code] but that doesn't work. I tried using the Code button but that didn't seem to work either (i.e. past code into editor, highlight, then hit the Code button). So how to add code tags? | |
Re: > I cant find any libcurl tutorial on the web. Huh? That's odd because I found lots of them [here](http://lmgtfy.com/?q=libcurl+tutorial) | |
Re: Testing ~~ printf("%02d", "something"); ~~ | |
Re: >This is what I have but it isn't working in the slightest..?? That program worked ok for me using VC++ 2010 Express on Windows 7. If its broken for you then I suspect that pheininger is correct in his assessment. Change int sixdigits to long sixdigits | |
Re: Code tags [code] [/code] don't work anymore. See the discussion in [this tread](http://www.daniweb.com/community-center/daniweb-community-feedback/threads/418759/code-tags) | |
How can I get there without going through another post that's already in Area 51? I don't see a link anywhere for it. | |
Re: If you want to put it into the first byte of ar[] then what you posted is ok. If you want to put it somewhere else then you have to tell the compiler where to put it, e.g. fread( &ar[i], 1, 1, fine); | |
Re: My guess is that readST() is trashing memory, and when that happens it can affect anything or everything ion the program. There is nothing in the code you posted that should cause the problem because all it does is open and close the files. | |
Re: If you want to convert "10" to 10 then you need to call one of the conversion functions, such as atoi() ~~~ printf("%d\n", atoi("10")); ~~~ | |
Do you get paid whenever I click one of the ads ? The reason I'm asking is because I want to decide whether to turn them off or not. Some of the ads seem to be worthwhile reading so if it will bring you more revenue then I might just … | |
Re: >Dani was kind enough to give the rest of us that ability. Any verified member can undo reputation. Yes I can confirm that works for non-staff members because I tried it to test something else earlier today. | |
Re: >Unfortunatly i do not know C C is not really a prerequisit for learning c++ unless your instructor and school says it is. The requirements you posted for the program are pretty vague. Is that all the info you were given? | |
Re: The problem could be line 15: many older compilers don't like declaring variabes anywhere except at the beginning of a block enclosed in { and }. That's ok with c++, but not C. | |
Re: You can't use cin >> name and expect to get a string with spaces. call getline() instead so that it will capture spaces within the string | |
Re: >Can someone please answer this for me as i cant do this practice question No, we do not do homework for people. Give it a try then post what you have attempted. | |
See my last two or three posts here: http://www.daniweb.com/software-development/c/threads/418582/system-function-problem When I enter "d.mkv" the editor removes everything but d.mkv. Not good when posting code. | |
Re: line 10: > )malloc(sizeof(argv) Wrong. sizeof(argv) is always 4 because its a pointer. | |
I a getting a bunch of db errors. Below are just a few of them > Deprecated: Assigning the return value of new by reference is deprecated in /home/daniweb/pfo_httpdocs/includes/init.php on line 49 Deprecated: Assigning the return value of new by reference is deprecated in /home/daniweb/pfo_httpdocs/includes/init.php on line 97 Deprecated: Assigning … | |
Re: > why a character array isn't being recognized as a pointer already. The reason is that you have hidden the global char array named "input" with the local parameter with the same name. In such cases the compiler ignores the global variable. To correct the problem delete the global array … | |
Re: You have to format the string with sprintf() before passing it to system() or rename() functions -- those functions don't work like printf(). | |
Re: The conversion will fail on languages that require more than one byte to represent a character such as many Chinese and Japanese glyphs | |
[URL="http://www.youtube.com/watch?v=L6dzUOYTQtQ&feature=ymg"]Here [/URL]is a YouTube video about how we celebrate this holiday :) | |
Will you please add a button to quickly copy code inside code tags to clipboard? I find it really annoying and inconvenient to use the mouse to highlight all the code inside code tags, it was a lot easier in the vBulletin version. | |
Re: >>while(fread(ar, 1, 20, file) != NULL) That only reads 20 bytes of data instead of 20 * sizeof(int) number of bytes. You need this? while(fread(ar, 20, sizeof(int), file) != NULL) >>how read one line at a time, You mean how to read one integer at a time? int i = … | |
Re: Are you talking about moderator permissions? I have not seen a permissions problem. | |
Is PFO coming back anytime soon? It's been swamped with spam the past few days, but I hope you will bring it back soon. | |
Re: >>how do i pass these to the functions in the driver file? The file that contains main() is considered the "driver file". In your first code snippet all you have to do is include the header file that you created, like this [code] #include <iostream> #include "myheader.h" // <<<<<<<<<<<<<<<<<<<<< here … | |
Re: Depends on the operating system. [URL="http://bytes.com/topic/c/answers/440423-how-recognize-function-keys-c"]Here [/URL]is one thread you might want to read. | |
Re: program statements have to be written in logical sequence. For example you can not add LetterGrade to Sum before you know the value of LetterGrade. And LetterGrade has to be converted from A to F into numeric value befor it can be added to Sum. [code] char LetterGrade = 'A'; … | |
Re: What compiuler? What operating system? What language? We need a lot more info. | |
Re: [icode]char* str[][/icode] is the same thing as [icode]char** str;[/icode], which is a two dimensional array where both dimensions are unspecified and must be allocated at runtime. [icode]char* str[5];[/icode] is also a two dimensional array, but in this case you have hard-coded one of the dimensions to be of length 5. … | |
![]() | Re: I think I read that the only difference is in the libraries to support the next generation of Windows. ![]() |
The End.