15,300 Posted Topics
Re: That function needs to be prototyped in McCauleyCurrencyConverterHeader.h | |
Re: >>rec.state == statecontrol You can not compare two strings like that. All that is comparing is the address of the two character arrays, not their contents. call strcmp() to compare the two. Also, I suspect you will have big algorithm problems because of the two while loops that both read … | |
Re: >>pst = (A*)malloc(sizeof(A)*1); 1. The "*1" is unnecessary and spurious. 2. C programs do not require typecasting. So remove that typecast. If your compiler complains then your are apparently writing a c++ program. 3. Move that structure above the functuion main() so that it is visible to all other functions. … | |
Re: That doesn't need a nested loop -- just a simple loop will be sufficient. | |
Re: yes, its true that with M$ compilers fopen and fstream eventually use win32 api functions. But there are a lot of reasons not to use win32 api for reading/writing text files and buffered i/o. Using either fstream or fgets() its really easy to read just one line of text (up … | |
Re: To accomplish the undo option all you need to do is make a copy of the chessboard before any move is made. After the move then use that copy for the undo option. | |
![]() | Re: >>a chess game that enables two or more players Never heard of a chess game played by more than two people (or one person and a computer). There are only two sides in a chess game -- white and black. It would be interesting to find out how three people … ![]() |
Re: I'm running Window 7 64-bit Home Premium, and CB Version 10.05 with MinGW. Did not have any problems starting the debugger when I selected menu Debug --> Start The first two images you posted are identical to the ones on my computer. I was unable to locate the screen you … | |
Re: add << right to the cout statement. I like to split up long lines to make them easier to read without horizontally scrolling the code window. Note that I changed some of the widths you had set, but you can use whatever you want. If you can you might want … | |
Re: Use a loop and iterate through the array with the loop counter as the index into the array. [URL="http://www.cppreference.com/wiki/algorithm/count"]Here [/URL]is another way it might be done using c++ algorithms | |
Re: >>char combinearrays(const char *array1, const char *array2) { The function needs to return a pointer to an array, not a single character. >>return *text; >>free (text); line 45 -- free(text) -- is unreachable and will never get executed because of line 44. line 44: should be [icode]return text;[/icode] -- remove … | |
Re: LEA means Load Effective Address -- so that will store the offset from the beginning of the data segment to the start of variable named VAR2 into the BX register. Read through [URL="http://www.laynetworks.com/assembly%20tutorials3.htm#loading"]this page[/URL]. MOV SI,OFFSET VAR1 does the same thing as LEA SI,VAR1 mov cl,[si] means to copy of … | |
Re: Do you know how to use ifstream to read text files? If you do, then just read each line of the file and compare the line with the permuted string. It's a simple while loop. | |
![]() | Re: The man is dillusional -- he's looking at a reflection of himself in a pond and thinks he sees a rabbit out of Allice in Wonderland. What does he do? He shoots at the rabbit, but the bullet reflects off the water and hits him in the forehead, killing him … ![]() |
Re: Look closely at line 157 and you will see that it is attempting to use salrate as if it were a single object, not as an array. You have to change either line 157 or line 17, but you can't use it both ways. | |
Re: get all input first using fgets() instead of that loop. Then to remove trailing white space start at the end of the string, search backward for the first non-white-space character and truncate the string at that point. If you also want to remove instances of two or more white space … | |
Re: you have to either include the implementation file for Gui class in the dll project, or link with a *.lib file that includes it in either another dll or static library. | |
Re: In the same folder as the compiler there is a program named dumpbin.exe. ( use a command prompt do run that file. You might also first have to run vcvars32.bat to set paths) It will list all the public symbols in a library. Run it against the library to see … | |
Re: what's the value of variables delta and d? Is either of them 0? The assertion failure can also be caused by something else in your program, such as writing beyond the boundries of the array. For example: [icode]o[delta*d][0] = 0;[/icode] will write to non-existant element of the array. And doing … | |
Re: If you want to do it using win32 api console functions then [URL="http://www.cplusplus.com/forum/beginner/4533/"]here [/URL]is a thread you might be interested in reading. | |
Re: Well, you can easily find that out for yourself. Just create an iterator and run through the vector to see if it was erased or not. [code] vector<card>::iterator it = cards.begin(); for(; it != cards.end(); it++) { cout it->name << '\n'; } [/code] | |
Re: >>"Board.C: In member function ‘void Board::input(bool)’: Are you sure that is the correct filename? *.C programs are usually compiled as C, not C++. | |
Re: >>3. Cross platform (I use OSX, windows, and a linux machine) That pretty-much limits the IDEs that are available on all three platforms. IMHO VC++ 2010 is the best IDE for MS-Windows, although Code::Blocks is ok too. Neither of them support multiple languages such as Java etc. But for C … | |
Re: I'm assuming this is a non-managed program, not Windows Forms which is managed cli/c++. Why don't you call win32 api [URL="http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx"]MessageBox()[/URL], which can be called from main(). main() can use the other windows controls providing it knows about the window's HWND handle. | |
Re: Welcome to DaniWeb -- I've had a lot of fun here myself from one old fart to another. I've also learned a lot of things from people with far less experience than I have -- just goes to show that you can learn something new every day no matter how … | |
Re: Instead of having all those arrays it would be better if you created a structure or class to contain all the data for one line, then create a vector of those classes [code] #include <iostream> #include <fstream> #include <string> #include <vector> #include <sstream> struct item { char s; int x; … | |
Re: >>I am running into some runtime issues with opening and procesing the file What, speficially, are the problems you have? compiler errors? If yes, then post a few of them. | |
Re: Did you read thrught [URL="http://www.daniweb.com/forums/thread70096.html"]the thread here in the c++ forum [/URL]about that topic? c++ standards only change once every 10 years or so, so if a book has been published within the past 10 years then it's not outdated. | |
Re: [URL="http://www.wired.com/gadgetlab/2008/11/four-future-gad/"]Here [/URL]is the future of computers, or is it the present? I think we are already living in the world of sci-fi gadgets. | |
Re: >>what is the maximum size length can be? The maximum value of unsigned int -- see your compiler's limits.h for that value. If you are reading the text file one line at a time, such as using getline(), then use std::string instead of char* so that you don't have to … | |
Re: You want a [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS397&=&q=code+beautifier+c%2B%2B&aq=1&aqi=g10&aql=&oq=code+beau&gs_rfai=C-mpTl7TKTNvENoiwyASXxcjWDwAAAKoEBU_QPt3h"]code beautifier[/URL] program. | |
Re: what opeating system? what compiler? GUI or console program? | |
Re: You are going to have to post the code you tried because we can't see your monitor. | |
Re: First step is to check if the first character is a numeric digit or an alpha character. If its a digit then just subtract '0' to make it binary [code] char input[]= "4"; int x = input[0] - '0'; [/code] Or you can use atol() to convert a string of … | |
Re: time.h has a function named difftime() that returns the difference between two time_t variables in seconds. Step 1: get birth date.convert it to struct tm the call mktime() which will return the time_t variable. Step 2: call time() to get current data/time in time_t Step 3. Call difftime() to get … | |
Re: what is foo() trying to do that that string? When you say "it doesn't work", what exactly do you mean by that? | |
Re: The same thing happens to your hard drive, if you sum up the size of all the partitions on your hard drive(s) it will be somewhat less than the manufaturer's stated size. The reason is that the operating system requires some space to store the file allocation table and other … | |
Re: The Item array you posted is a static array, not a dynamic array. To convert it to a dynamic array you have to make it a pointer and then use new to allocate the array siz [code] Item* list; list = new Item[maxnumber]; [/code] After that you can put maxnumber … | |
Re: >>PS: is %u Ok for printing out addresses If you want to see the address in hex instead of decimal use %p This example will show you how data is stored in memory [code] #include <iostream> int main() { int x = 123; char buf[sizeof(int)]; *(int *)buf = x; for(int … | |
Re: Another way is to call _stat(), which will return the file size among other things. | |
Re: >>At least where can I find useful information MSDN is the best source for win32 api functions. I don't like OpenFile() because it only does binary reads/writes, but is useful to serialize MFC objects with CArchive MFC class. Otherwise I much prefer standard c++ fstream. Just because you are writing … | |
Re: Look at the date of her post -- "tonight's episode" was aired about 4 years ago :) | |
Re: You need to visit [url]www.codeproject.com[/url] -- it has the largest repository of MFC and Windows code on the internet, along with tutorials and other articles. I know it contains buttons of various shapes as you described. If you are writing MFC programs, then being a member of codeproject is an … | |
Re: You should note that String^ and std::string& are NOT the same thing. You can not mix the two (String is managed c++, std::string is unmanaged c++). Also, strcpy() will not work with either String^ or std::string without some sort of conversion, such as using std::string's c_str() method. Since you are … | |
Re: Does that compiler have a limit on the length of a symbol? I recall very very old C compilers had a limit of 6 characters for symbol names (this was in the days before c++). | |
Re: [URL="http://www.programmingforums.org/forum64.html"]Sane's Monthly Algorithms Challenge[/URL] | |
Re: Yes it is possible. A segment is determined by the address in ds register. It has nothing to do with align type. AFAIK segments are never closer than 16 bytes (one paragraph), which is the smallest amount of memory that will be returned by memory allocation function (int 21h, function … | |
Re: When you instantiate a single instance of a c++ class the constructor is called, and that's where the class is initialized. The same thing happens when you create an array of c++ classes. >>do I still have to have a constructor for the class? Depends on the class, but in … | |
Re: Since you didn't bother to use code tags I'm not going to bother reading it very well. The problem is most likely using calloc() instead of realloc() to increase or decrease the size of the buffer. |
The End.