15,300 Posted Topics
Re: MAX is not a function -- it is a macro. The macro says if a is greater than b then return a otherwise return b. | |
Re: [QUOTE=KahneFan;770094]Side question: Do you have to pay for mods, or are there some for free?[/QUOTE] We are all unpaid volunteers, which is one reason to have quite a few mods located all around the world for 24/7 coverage. | |
Re: If you have a standard C or C++ program you can use the [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atexit.html"]atexit() function[/URL] | |
Re: [QUOTE=ARYT;809317]It's Ok. I know the rules. [/QUOTE] Apparently not well enough to add code tags [noparse] [code=cplusplus] // your code here [/code][/noparse] ![]() | |
Re: change the reference to a pointer and see if that solves the problem. | |
Re: I'm not much on linux either, but I think you can combine all that into one statement: [icode]g++ vector_jar_test.cpp marble.cpp[/icode] will create the executable file a.out. | |
Re: lines 16, 17 and 18: too many loops and too many fgets() function calls. The while statement will read the entire file. Also you can use retazce like that because its just an array of pointers that point to nowhere. You have to first read the line into a valid … | |
Re: you should not have to modify that header file. Just add that header file to the *.cpp program's includes, call the functions, and tell the compiler what *.lib file to use. You could use a pragma to do that in the *.cpp file [icode]#pragma comment(lib, "mylib.lib");[/icode] or add it to … | |
Re: The vector isn't expecting a pointer. Change the vector to this if you want pointers: [icode]vector<Shape*> shapes;[/icode] | |
Re: static class members have to also be declared globally just like any other global object [code] // in the *.cpp file #include <iostream.h> #include <conio.h> #include "LineStorage.h" [color=red]LineStorage::vector <vector <vector<char> > > S;[/color] void LineStorage::setchar(int l,int w,int c,char d) { vector <char>::iterator it=LineStorage:: S[l][w].begin(); LineStorage:: S[l][w].insert((it+c-1),d); } [/code] | |
Re: >>Is there a command in C++ that I could use to capitalize only the first letter and not the whole word? No. You have to do that yourself. The toupper() function works on only one character. Instead of all those gets(), you would just get input from the keyboard in … | |
Re: there is no such thing as an "obj-c" class. C language knows nothing about classes. Maybe you mean a structure object declared in a c translation unit (*.c program) ? [code] // *.cpp file extern C int myint; [/code] if you have a large group of objects [code] // *.cpp … | |
I came across this utube video while doing my modly duties on PFO. What an ingenious device that lets one man do the work of a hundred men. [url]http://www.youtube.com/watch?v=g658QgjFYt0&eurl=http://www.containerlift.ru/&feature=player_embedded[/url] | |
Re: For some reason ifstream doesn't work with that file. Change it to FILE pointer and it works ok [code] // ifstream inPresFile("presfile.dat"); FILE* inPresFile = fopen("presfile.dat", "rb"); // <<< THIS if (!inPresFile) { cout<<"File could not be opened"<<endl; exit(1); } heading(); int counter = 0; //for (int counter=1; counter < … | |
Re: line 50 and 51: array numbers always begin with 0, not 1. [code] for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { num[i][j] = j+1; } } [/code] line 44: >>matrixPermute (temp); This is a recursive function call, yet you always … | |
Re: If the string looks something like this: [icode]Dani Web 100[/icode] Then just use getline() to read the entire line, and start at the end of the string and back up until you find the first space, split the string at that point. | |
Re: how to do that will depend on the compiler, each one is a little different. Do you mean you want to put the source files, such as *.cpp, *.c, and *.h, in different folders? | |
Re: >>my biggest problem at the moment is how do I pass the pointer into the function when the pointer is pointing to a struct? Do it the same as you would do with any other data object, such as a pointer to an int [code] void foo( Divison* pDiv) { … | |
Re: Welcome to DaniWeb. There are quite a few of us older people here now. Welcome to the gang :) | |
Re: line 10: that function gets the file size the hard and slooooow way. All you have to do is seek to the end of file then call tellg() to get the file size -- only two lines of code :) If you want to leave that function as it is, … | |
Re: pass it as a parameter to DrawingARect() and to the drawing functions in your class. | |
Re: [QUOTE=odzky;809747]Create a function w/c accepts as input the double numbers x1,x2,x3 and returns to the program the value of the average (x1+x2+x3)/3 as a variable parameter. #include<stdio.h> #include<conio.h> main() { [/QUOTE] stdio.h and conio.h are both C header files, not c++. you posted this in the c++ forum -- is … | |
Re: Ok, what is it? An advertisement (spam) for a book from amazon ? | |
Re: [QUOTE=niek_e;795835]Yes there is. He's called [URL="http://www.daniweb.com/forums/member46588.html"]Ancient Dragon[/URL] and is moderator right here at Daniweb :)[/QUOTE] Thanks Nick, I'll remember that next time :) [quote][URL="http://en.wikipedia.org/wiki/Geek"]This word comes from English dialect geek, geck: fool, freak; from Low German geck, from Middle Low German. The root geck still survives in Dutch gek: crazy, … | |
Re: [QUOTE=Lardmeister;805810]Doesn't this short poem about love just melt your heart? Note: Sorry AD about the dragon slaying stuff, it's not my poem.[/QUOTE] No offense taken -- I was slain a lot of times in my D&D games :) | |
Re: you can't do xor operation on an entire array -- only one element at a time. [icode]msg[0] ^= generator;[/icode] | |
Re: >>else if(currentChar == "" ) cout << " " << endl; change that "" to " " (with a space between the quotes) [code] else if(currentChar == "" ) cout << " " << endl; else if(currentChar == ",") cout << "," << endl; else if(currentChar == ".") cout << … | |
Re: >>Why is element not declared? Because you have recursive includes -- each header file includes the other. In eventhandler.h try this: [code] #ifndef EVENTHANDLERH #define EVENTHANDLERH [color=red]class element; [/color] // forward declaration of class enum events {onClick, onHover}; typedef struct eventHandlerT { void(*func)(element *elem); events eventType; } eventHandler; #endif // … | |
Re: open the file read each line for each line read, search the line for the given word. If you ust std::string to hold the line then use it's find() method. You will probably first have to convert the line to all lower or upper case so that you get case-insensitive … | |
Re: Once in what time-span? Such as once an hour? once a day? I would probably store the current date/time in the ini file, then on program startup read that information and act according to how often the program should run. such as if its not time to synchronize the clocks … | |
Re: >>[color=red]pers[i].haemta_betalat() [/color]= pers[i].haemta_betalat() + pny.haemta_betalat(); haemta_betalat() is a function call, you can not add anything to its return value. What you want is this: [icode]pers[i].betalat_andras = pers[i].betalat_andras + pny.haemta_betalat(); [/icode] But that might give you an error too since betalat_andras is a private member of the class. You could fix … | |
Re: getline() will read the entire line [code] std::string line; std::ifstream in("filename.txt"); while( getline(in, line) ) { cout << line << "\n"; } [/code] | |
Re: >>What memory model does Dev-Cpp follow...? Flat memory model, the same as all other 32-bit compilers. >>And how can I change it to have a segment more than 64 KB of memory You don't have to change it. You can write a program of about 2 gig in size if … | |
Re: The implementation of cin and cout is compiler/os dependent. On MS-Windows I suspect Microsoft implemented it by using win32 api console functions. And, as others have said, this is very advanced programming. [URL="http://www.codeproject.com/KB/winsdk/JLib.aspx"]Here [/URL]is some source code if you are up to the task. You will find more information [URL="http://letmegooglethatforyou.com/?q=windows+console+functions"]here.[/URL] | |
Re: [QUOTE=C.G.P.;802482]CSCGAL. I just joined the DaniWeb Community and noticed that I can't even view my profile. It's odd, I can't even figure out how to view my own profile.[/quote] Click the CONTROL PANEL link at the very top of the page. You can access your profile from that dropdown menu. … | |
Re: The "thing" at the start is probably a binary character that tells programs the file is UNICODE format -- its called "[URL="http://www.helpware.net/FAR/help/Unicode2.htm"]UNICODE signature[/URL]". When you click [URL="http://www.helpware.net/FAR/help/Unicode2.htm"]this link [/URL] scroll down the page until you find the section titled "unicode signature". Please feel free to read the rest of the … | |
Re: M3rcury: the code you original posted is worthless to us. Post the new code (all of it) that you are actually using and which is giving you problems. And thanks for using code tags correctly, not many new posters bother to do that :) :) | |
Re: Welcome to DaniWeb where you will find several of us old folks here and even a couple teachers. | |
Re: Read the list of format specifiers for [URL="http://www.cplusplus.com/reference/clibrary/cstdio/printf.html"]printf() function[/URL]. You will see that %d is decimal, %o is octal and %x is hex. With that information you should be able to write your program in just a few lines of code -- one line of code for the actual print … | |
Re: [QUOTE=Rashakil Fol;805193] This unacceptable, and I demand that this be fixed! How can I give information when these unkempt forum icons are profaning the digital landscape with their pixels of evil on every other page I visit? Dictated but not read, Rashakil Fol[/QUOTE] If you are trying to be funny … | |
Re: >>When I try to compile this Makefile I get errors like boostnb.o is missing. Well, did you check the file system to see if it is missing? If it is then it didn't compile correctly or you failed to add it to the makefile, and you should have received error … | |
Re: I have had XP Pro for some time and just today installed Vista Home Premium. It would not allow me to upgrade XP Pro because it said I would need the Business or better version. So it did a fresh install on a second drive d: in my computer and … | |
Re: There are some legitimate reasons to do such a thing. I've done something similar before so that I could keep the two files together without resorting to writing an installation program. I think there are at least two choices: 1) compile it as a resource in the resource file. 2) … | |
Re: It might be your computer, your window resolution setting, or your operating system. install another font perhaps? search [url]www.codeproject.com[/url] or some other similar sites for example code. | |
Re: Sorry bud -- we don't condone downloading illegal copies of published books. | |
Re: There are literally thousands of win32 api functions, and more are added with each new version of MS-Windows. You will not find all of them in any one place, except possibly MSDN at [url]www.microsoft.com[/url] | |
Re: I found [URL="http://www.autoitscript.com/forum/index.php?showtopic=70853"]this with google [/URL]-- and you could have too. But I don't know if it answers your question. | |
Re: all your program is doing is parsing the filename (see line 11). What you need to do is read a line from the file then call strtok() on the input buffer for that line, such as [code] char line[255]; while( fgets(line, sizeof(line), file) { ptr = strtok(line, ","); // assume … |
The End.