15,300 Posted Topics
Re: >> strcpy(view[place[i].y][place[i].x],"s");//says that the problem is here[/b] That is just a character, not a pointer. same as attempting to do this: [icode] strcpy( view[0][0], "S");[/icode] If all you want to do is replace the single character then use the assignment operator, not strcpy(); [icode] view[place[i].y][place[i].x] = 's';[/icode] | |
Re: >>I tried them but i cant seem to get them to compile post the code you tried. | |
Re: >>capitalize the first letter of each word they type in, One way to do it would be to use strtok() to find each work then toupper() to change the first character to upper case. strtok() modifies the original string so you will want to make a copy of the string … | |
Re: You are getting those errors because you didn't write those functions yet. The three lines just before main() are not functions, they are just [b]prototypes[/b], which tell the compiler about the return value and parameters. You still have to write all the code that makes them do something. | |
Re: Are you looking for a function that takes a variable number of arguments such as printf() ? [icode]void foo(int a, ...);[/icode] Look up [URL="http://www.opengroup.org/onlinepubs/007908799/xsh/varargs.h.html"]varargs.h[/URL] and associated functions. | |
Re: typecast it [code] float n = 123.45F; double x = (double)n; or double x = static_cast<double>(n); [/code] | |
This doesn't work very well any more. Something broke just today I think. See [URL="http://www.daniweb.com/forums/thread113546.html"]this thread[/URL] and click the Toggle Plain Text link.The whole thing shrivels up to just one or two lines with vertical scrollbar. In the last post in that thread all the text is placed on one … | |
Re: >>//why this doesnt have sizeof? =)temp->name=(char*)malloc(strlen(tempString)+1); >>//this is based on the linked list example 1(above) >>//why this doesnt have sizeof? =) It doesn't use sizeof(tempString) probably sizeof(any pointer here) is only 4 on 32-bit machines while the length of the string can be much much more than that. And the … | |
Re: line 4: delete it because its redundent. Its not necessary to predeclared the class if your going to fully define it in the very next line. line 13: As written that function does nothing. YOu need to add a bit of code that sets array Grade = array G. line … | |
Re: It can't be done in MS-DOS either because there are no email servers for that os. | |
Re: >>What topics or lessons should i master All of them. Buy a book Introduction To C++ (there are lots of good ones) and start studying from page 1. | |
Re: do you have to write your own linked list or can you use ready-made such as <list> ? Isn't the information about files and lists in your textbook? Did you read your textbook? | |
Re: >>The program is working fine your program may be complete but it is NOT working fine as you stated. Why? Because line 41 is wrong -- feof() doesn't work like that. And the loop from lines 46-60 is also written inefficiently. [code] vector<string> words; // an array of words while( … | |
Re: line 40: You are attempting to use an uninitialized pointer as the input buffer to `getline()`. That will most certainly cause your program to scribble all over hell and back and is most likely one of the causes of the behavior you are reporting. On line 38 replace `char *a;` … | |
Re: >>Wow, no one after an hour? Is it that hard or did I just mess it up that badly I was naping :) function [b]totallength()[/b] The parameter must have a variable name, you can't just put a data type without a variable named. Variable names can be omotted ONLY in … | |
Re: You mean you have two *.cpp files that you want to compile together into one executable program? Yes, put one in the program's main thread, create another thread during initial startup in main() then put the other code in the second thread. Exactly how to do that depends on the … | |
Re: >> cin >> address; The >> operator does not accept spaces. So if your address contains spaces it will pick up only the text before the first space. Use getline() to get everything including spaces. | |
Re: The functions in graphics.h are only supported by old ancient Turbo C and Turbo C++ compilers. Those functions can not be used by any modern 32-bit compiler. You can either get a copy of that old MS-DOS compiler or use win32 api GDI functions or get one of several graphics … | |
Re: I find IE7 more difficult to use then IE6 despite the new tabs. I still like FF better and use it all the time at home. I'm not allowed to use FF at work -- only IE. | |
Re: line 28 and 36: array index values begin with 0, not 1. Those two loops will cause the program to write beyond the bounds of the array. Code them like this: [icode]for (count = 0; count < testscore; count++)[/icode] You can do everything on just one loop -- no need … | |
Re: You could just ask Rational :-O | |
Re: post a few errors (and the line numbers they appear on) | |
Re: take all the shopping channels off, but someone must be buying all their crap or they wouldn't be selling it on tv. | |
Re: What are you trying to count? Number of examcodes for each student? line 10: you want to use the == operator there, not the assignment = operator. | |
Re: You've added a lot of great comments and helping others. Keep of the great work :) | |
Re: Welcome to DaniWeb. >>I'm not a guru so I might be in the wrong place There are a lot of people who are not guru's. Please feel free to browse through all the boards and participage where you feel you want to, which I hope is often. | |
| |
Re: >>P = (rho * g * delta_h_water) + 1 atmosphere [code] int P; int rho; int g; int delta_h_water; //set those values to some values is not shown P = (rho * g * delta_h_water) + 1 ); [/code] >>V = pi r^2 * h [code] #include <cmath> double V; … | |
Re: line 11: that is a pretty screwy way to generate a random number. The normal method is to first seed the random number generator so that you get a different set of random numbers each time the program is run. [code] int main() { srand( time(0) ); int x = … | |
Re: >>im a biginner level in Visual C++ version 6.0 That's unfortunate because that old compiler doesn't support c++ very well. You will be much better off if you download VC++ 2008 Express, which is free for the downloading. Otherwise, I don't know the answer to your question. | |
Re: Look at an [URL="sum_total"]ascii chart[/URL] -- the letters 'A' - 'Z' have decimal values of 65 - 90. So just generate a random number between 0 and 26 then add 65. | |
Re: It doesn't compile because it is missing the header file <fstream> | |
Re: I realize you didn't post all your program, but what do you do with the vector [b]ReadInData[/b] that is declared inside that for loop ? The entire vector is destroyed on each loop iteration and you do nothing with it but toss it into the bit bucket. | |
Re: you are using the wrong compiler. Get ancient TurboC or Turbo C++ and it will probably compile. | |
Re: InitApplication() references a function names WinProc. You have to add that function to your program before it will link successfully. That function will probably be explained a little further on in your book, or you can study [URL="http://www.winprog.org/tutorial/"]this tutorial[/URL]. | |
Re: function profiling is calculating the amout of time it takes for a function or other algorithm to execute. Because they execute so quickly it is usually necessary to crete a test program that will run the test data through the algorithm thousands of times in order to achieve a measurable … | |
Re: [URL="http://msdn2.microsoft.com/en-us/library/ms724845(VS.85).aspx"]RegDeleteKey()[/URL] | |
Re: Is there a reason there is so much extra bloat in that program ? For example there no need for variable [b]pb[/b] at all or for the parameter in function [b]calc[/b] Here is a somewhat simpler version: It could be simplified a lot more but I don't know what you … | |
Re: If you have all the source code then just export it and recompile. Put the class in a *.h file and include it in the application *.cpp file like you would any other header file, then at link time link with the *.lib file that's created when you compiled the … | |
Re: Welcome to DaniWeb. Post your question in Tech Talk and I know someone will be able to assist you. | |
Re: There are thousands of free programs at [url]www.codeproject.com[/url]. | |
Re: [URL="http://www.space.unibe.ch/comp_doc/c_manual/C/CONCEPT/bitwise.html"]Bitwise operators[/URL] The last one, line 15, is just null-terminating the string. The author could have simply use 0 instead of 0x00. | |
Re: [icode]x = tolower(x);[/icode] is how you convert the character in variable x to lower-case. | |
Re: The maximum would be 5 + 10, just toss out all negative values. | |
Re: there are several ways to convert a string of digits to an integer. One of them is by using c++ stringstream class, which is based on fstream but works on strings instead of files [code] #include <string> #include <sstream> int main() { char digits[] = "1234"; int x = 0; … | |
Re: use a program such as Paint to draw new bitmaps then recompile the program ??? | |
Re: >>'fopen' was declared deprecated That's only a microsoft warning. You can just ignore it because the c++ standards has not made it deprecated. FILE, fopen() and all associated functions are declared in stdio.h, not iostream or fstream. In c++ programs you really should not be using those C functions, in … | |
Re: never heard of getdate() and setdate(). But time.h, or ctime, has similar standard C functions getsystime() and setsystime(). [edit]After looking at the link Nick posted I realize they are not the same afterall.[/edit] @technogeek: (you name is a misnomer). If you scroll down to the bottom of nick's link it … | |
Re: >>What do you mean by the functions having an internal linkage? [URL="http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/language/ref/clrc01cplr081.htm"]Explaination here[/URL]: >>Also, from my understanding, an anonymous namespace is just one without a name, so how would I call that? The same way you do all other functions in the standard C/C++ libraries (other than class libraries). None … |
The End.