15,300 Posted Topics

Member Avatar for adaniel058
Member Avatar for adaniel058
0
140
Member Avatar for littleCuteMaria

>>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 …

Member Avatar for Ancient Dragon
0
123
Member Avatar for vijay.neo

>>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. …

Member Avatar for ahmad chehade
0
206
Member Avatar for hannlim
Member Avatar for Sohelp
0
64
Member Avatar for Micko

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 …

Member Avatar for progneer.soft
0
8K
Member Avatar for phfilly

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.

Member Avatar for phfilly
0
597
Member Avatar for getack

>>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 …

Member Avatar for getack
0
259
Member Avatar for moufoo

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 …

Member Avatar for Ancient Dragon
0
737
Member Avatar for jmcorpse

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 …

Member Avatar for Ancient Dragon
0
73
Member Avatar for Hey11

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

Member Avatar for vijayan121
0
82
Member Avatar for Masas

>>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 …

Member Avatar for savdapu krishna
0
288
Member Avatar for moonL!ght

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 …

Member Avatar for Ancient Dragon
0
84
Member Avatar for jordankaushik

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.

Member Avatar for jordankaushik
0
107
Member Avatar for ageq
Member Avatar for iamthwee

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 …

Member Avatar for diafol
1
390
Member Avatar for SHENGTON

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.

Member Avatar for Ancient Dragon
0
173
Member Avatar for nathanurag

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 …

Member Avatar for vinitmittal2008
0
173
Member Avatar for chavez

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.

Member Avatar for shijobaby
0
513
Member Avatar for hermann87

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 …

Member Avatar for shijobaby
0
352
Member Avatar for EngSara

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 …

Member Avatar for shijobaby
0
183
Member Avatar for goodi8u

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.

Member Avatar for goodi8u
0
248
Member Avatar for cclausen7

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]

Member Avatar for StuXYZ
0
74
Member Avatar for Mbot

>>"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++.

Member Avatar for Fbody
0
497
Member Avatar for ayoitzrimz

>>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 …

Member Avatar for ayoitzrimz
0
169
Member Avatar for Gramotey

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.

Member Avatar for Gramotey
0
202
Member Avatar for cbsinc

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 …

Member Avatar for cbsinc
0
140
Member Avatar for Alexkid

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; …

Member Avatar for Ancient Dragon
0
198
Member Avatar for DishevldPeasant

>>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.

Member Avatar for Ancient Dragon
0
145
Member Avatar for Ace1.0.1.

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.

Member Avatar for Ancient Dragon
0
147
Member Avatar for cwarn23

[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.

Member Avatar for happygeek
0
155
Member Avatar for Jsplinter

>>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 …

Member Avatar for Jsplinter
0
157
Member Avatar for sundip

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.

Member Avatar for sundip
0
70
Member Avatar for tiger86
Member Avatar for atramposch
Member Avatar for Ancient Dragon
0
152
Member Avatar for Ninoaoe

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 …

Member Avatar for Ninoaoe
0
132
Member Avatar for comsians

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 …

Member Avatar for comsians
0
365
Member Avatar for ricardo.crudo

what is foo() trying to do that that string? When you say "it doesn't work", what exactly do you mean by that?

Member Avatar for Ancient Dragon
0
175
Member Avatar for pordsky

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 …

Member Avatar for Ancient Dragon
0
81
Member Avatar for Diogo Martinho

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 …

Member Avatar for Fbody
0
165
Member Avatar for myk45

>>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 …

Member Avatar for Ancient Dragon
0
100
Member Avatar for heidik

Another way is to call _stat(), which will return the file size among other things.

Member Avatar for Ancient Dragon
0
354
Member Avatar for chiyuwang

>>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 …

Member Avatar for Ancient Dragon
0
85
Member Avatar for Dani

Look at the date of her post -- "tonight's episode" was aired about 4 years ago :)

Member Avatar for WASDted
0
231
Member Avatar for punchinello

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 …

Member Avatar for punchinello
0
81
Member Avatar for Scoppio

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 …

Member Avatar for Scoppio
0
207
Member Avatar for arun_l

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++).

Member Avatar for arun_l
0
156
Member Avatar for sahil1991

[URL="http://www.programmingforums.org/forum64.html"]Sane's Monthly Algorithms Challenge[/URL]

Member Avatar for Ancient Dragon
0
173
Member Avatar for titan_550

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 …

Member Avatar for titan_550
0
123
Member Avatar for ayesha91

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 …

Member Avatar for ayesha91
0
123
Member Avatar for Perry31

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.

Member Avatar for Perry31
0
150

The End.