15,300 Posted Topics
Re: both Code::Blocks and vc++ 2010 Express are current and free. If you want the source code to be compatible with *nix then use Code::Blocks because that compiler is available on both operating systems. | |
Re: The trick to writing complex programs is to break it down into much smaller parts. For example the first thing you want to do is write a program that lets you enter the date as a character array. Once you have that working, take the char array and break it … | |
Re: I don't use any of them -- just a PC, simple and cheap Sprint cellphone (with no internet connection) and a Samsong tablet. >>I know it’s a question that is not only as old as time itself You aren't very old, are you :) :) They've only been around since … | |
Re: Create it exactly like you would a 1d array but twice as large. If its an integer array then it needs to be sizeof(int) * 20 * 20 bytes, or 4*20*20 = 1600 bytes.How you store the data is pretty much up to you. One way is to store all … | |
Re: Yes, linked lists can be a bit tricky to program. Study some of [URL="http://www.google.com/#hl=en&sclient=psy-ab&q=c%2B%2B+linked+list+tutorial+beginners&pbx=1&oq=c%2B%2B+linked+list+tu&aq=1&aqi=g2g-j1g-jC1&aql=&gs_sm=1&gs_upl=0l0l1l367l0l0l0l0l0l0l0l0ll0l0&gs_l=hp.1.1.0l2j0i18j0i18i33.0l0l1l367l0l0l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=7474e8d0b895000c&biw=1033&bih=518"]these links[/URL] | |
Re: The solution is identical to the RemoveSpaces() program I showed you in the other thread except check for vowels instead of saces. | |
Re: there is no problem with malloc() -- what you see is called undefined behavior, or array out-of-bounds error. The compiler won't complain about it because it assumes (usually wrongly) that you know what you are doing. What happens when you do that? The program just scribbles stuff all over memory, … | |
What is this new advertising I see in threads -- some words look like links but when I hover the mouse over them an advertisement pops up. | |
Re: here is one way to do it [code] void RemoveSpaces(char *str)7 { int i = 0; int length = strlen(str); while(i < length) { if( isspace(str[i]) ) { memmove(&str[i], &str[i+1], length-1); --length; } else ++i; } } [/code] | |
Re: First you will have to port the c++ code to cli/c++ (managed code) then put it in a DLL. If you don't know how to create a dll then learn how to do it -- [URL="http://msdn.microsoft.com/en-us/library/ms235636.aspx"]here[/URL] is a tutorial. Next read through a couple of [URL="http://www.google.com/#hl=en&gs_nf=1&cp=27&gs_id=30&xhr=t&q=how+to+call+cli%2Fc%2B%2B+from+C%23&pf=p&output=search&sclient=psy-ab&rlz=1C2CHFX_enUS452US455&pbx=1&oq=how+to+call+cli/c%2B%2B+from+C%23&aq=f&aqi=&aql=&gs_sm=&gs_upl=&gs_l=&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=994a272661dedc15&biw=1735&bih=908"]these google links[/URL] to find … | |
Re: When you enter a number you have to press the <Enter> key, right??? Well, scanf() leaves that '\n' <Enter> key in the keyboard so the next time scanf() or some other keyboard function is called all it will get if the '\n' Enter key. what you have to do is … | |
Re: google for "c++ odbc tutorial", there are lots of them. | |
Re: It would be alot simpler if you stored the words in a structure so that the English and French words can be kept together. [code] struct words { char English[max_word_len]; char French[max_word_len]; } [/code] Then make an array of structures [icode]struct words array[40];[/icode] You might also have to change the … | |
Re: 1. Move those two huge arrays on lines 15 and 16 up above main() so that they will not be on the limited stack. 2. All array idices are numbered 0 to, but not including, the declared array size. So an array with 800 elements are numbered 0 to 799. … | |
Re: Also, was temp initialized before calling strcat() the first time? eg. [icode]char temp[50] = {0};[/icode] | |
Re: One common way is to allocate memory in fixed block sizes. When that fills up then allocate a larger array. Here is an example [code] int array_size = 0; // initial array size int elements_used = 0; // current number of elements used in the array int *array = NULL; … | |
Re: It might depend on what language you want to write your program with. excel spreadsheets are very difficult, if not impossible, to work with in most languages (vb.net is one exception). A better and more portable solution is to create a database with either MS-Access (not free) or MySQL (free) | |
Re: you need to convert the integer to a char*, not char. [code] char score2[20]; sprintf(score2,"%d", score); [/code] | |
Re: line 13: exit is the name of a standard c or c++ function. Give that variable a different name. line 1163: don't call main() anywhere in your program. That function should only be called by the operating system. If you need to repeat the code that is in main() then … | |
Re: You have to format that char* before calling TextAdd(). There are several ways to format it, one way is to use std::stringstream from <sstream> header file, another way is to use sprintf(). [code] #include <sstream> int main() { int score = 123; stringstream str; str << score; std::string s; s … | |
Re: I know of no way to do that. | |
Re: Read [URL="http://www.daniweb.com/software-development/cpp/threads/89261"]this thread[/URL] | |
Re: Line 12 is pretty much useless. If LoadLibrary() fails then there is no reason to call FreeLibrary(). Call FreeLibrary() only when the process is done using it. Also, add an error message and return on line 13 when LoadLibrary() fails. Why it fails to work the second time, I don't … | |
Re: The reason is there is a maximum value that an integer can hold -- the maximum is declared in the header file limits.h that is supplied by your compiler. What you are seeing is called numeric overflow. If you need bigger numbers then use a bigger integer, such as "long … | |
Re: I use Chrome and never have that problem. Most likely a problem with the cookies on your computer. If you delete the DaniWeb cookies then yes, you will have to log in manually again. | |
Re: use getline() instead of >> operator. [icode]fin.getline(string2, sizeof(string2));[/icode] Or if you use std::string [code] std::string string2; getline(fin, string2); [/code] | |
| |
Re: Post the entire program because the code snippet you posted compiles ok for me using vc++ 2010 express compiler/IDE. [edit]I used the exact same code as ^^^ posted. | |
Re: lines 30-32: the value of k is a negative number when i is 0. Do the first time through using k as index is illegal because there is no such thing as -1 index of arrays. | |
Re: You can't fix it with that compiler because that compiler version is too old. Get free Code::Blocks with MinGW ([URL="http://www.codeblocks.org/"]link here[/URL]), which is current. | |
Re: That's not possible unless you are writing a compiler and then it would be a compile-time check, not a runtime check. | |
Re: No. All you have to do is initialize pointers to NULL when declared, e.g. [icode]int *ptr = NULL;[/icode] or set them to NULL in c++ class constructors. There is no such test for other kinds of variables. But you can either write your own or use an existing smart pointer … | |
Re: Use a loop. There are three kinds of loops: for loop, while loop, and do loop. Use the one that best fits the situation. [URL="http://www.cprogramming.com/tutorial/lesson3.html"]Read this short tutorial[/URL] | |
Re: >> for (int n=0;n<=99 ;) What makes you think there will be 99 characters in the string? You should use this: [icode]for(int n = 0; n < words.size(); )[/icode] Also not that you should use <, not <= | |
Re: Are you using Windows Forms program? Or something else? General, make a public function in Form2 that Form1 can call and pass the data. Form1 will have to get a pointer to Form2 in order to do that. Another way is to put the data into a common data file … | |
Re: >>how can i access the variables of my "xyzView.cpp" file in the Dialog Box CDocument class contains a linked list of CView classes. So first you have to get a pointer to CWinApp by calling AFX::GetApp(), then from that pointer get a pointer to CDocument using its GetNextDocumenTemplate() method. Since … | |
Re: Torrents in and of themselves are no more illegal than any other program. Its how you use the torrent that can become a legal issue. | |
Re: Maybe someday Dani will put that feature in PFO too. I'm getting tired of banning signature spammers. | |
Re: See [URL="http://www.daniweb.com/software-development/cpp/tutorials/90228"]this tutorial[/URL] | |
Re: why aren't you just reading the data as integers instead of strings? It would be a lot simpler and you won't have to worry about spaces. I'd put the data into a 2d array of ints which would then be easy to sort. | |
Re: [URL="http://www.cplusplus.com/forum/general/8510/"]Here's a link [/URL]for MS-Windows (and it won't matter which 32-bit compiler you use. It won't work with Turbo C or Turbo C++) | |
Re: This [URL="http://msdn.microsoft.com/en-us/library/aa716527(v=vs.60).aspx"]Scribble tutorial[/URL] will show you how to draw lines with MFC | |
Re: The program must know what operating system its running under because it has to be recompiled for each os. Add some sort of preprocessor directive that tells the program what os its being compiled for. For example, you might put the define _WIN32 in the makefile when compiled for MS-Windows … | |
Re: google for "mixed language programming" and you will find quite a bit about that topic. Its easier to mix C with other languages than it is c++, but it can be done. C++ will probably need some C wrapper functions in order to mix them with other languages because of … | |
Re: See [URL="http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/5f415587010e7b8c"]this thread[/URL] for some hints | |
Re: You don't link the database itself, but a library of functions. There are at least two ways to do this: 1) ODBC -- see [URL="http://www.google.com/#hl=en&output=search&sclient=psy-ab&rlz=1C2CHFX_enUS452US455&q=odbc+tutorial+c%2B%2B&psj=1&oq=odbc+tutorial&aq=1&aqi=g5g-v5&aql=&gs_sm=1&gs_upl=2784l5527l0l8498l13l13l0l5l5l0l86l479l8l8l0&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=f0b85e3c6de8b9f9&biw=1616&bih=909"]this tutorial[/URL] 2) ADO -- [URL="http://www.google.com/#hl=en&output=search&sclient=psy-ab&rlz=1C2CHFX_enUS452US455&q=ado+tutorial&psj=1&oq=ado+tutorial&aq=0&aqi=g4g-v6&aql=&gs_sm=1&gs_upl=1168l3630l0l7058l12l12l0l5l5l0l95l421l7l7l0&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=f0b85e3c6de8b9f9&biw=1616&bih=909"]tutorials here[/URL] Both the above require a good deal of programming and require a good grasp of c or c++ languages. … | |
Re: Either vc++ 2010 or Code::blocks will work (assuming you are using MS-Windows). vi or Code::Blocks on *inx. | |
Re: If you are writing a c++ program why are you using c's gets() function instead of c++ cin or getline()? >>if (test[i]=='a' || test[i]=='e' || test[i]=='i' || test[i]=='o' || test[i]=='u' || test[i]=='A' || test[i]=='E' || test[i]=='I' || test[i]=='O' || test[i]=='U') { test[i]=' '; Probably easier to use a switch statement … |
The End.