15,300 Posted Topics
Re: 1. Just attach the file to your post here. Nobody will download that file for fear it might contain viruses or worms. 2. Why don't you translate it yourself. | |
Re: It is compiler dependent. Some compilers might define DEBUG, others _DEBUG, and still others might not define it at all. IMHO the best way to do it is to define the macro yourself in command-line options, such as -DDEBUG. | |
Re: delete that while loop -- no loop is necessary with the code you wrote because it reads and writes the entire file in one big swoop. That isn't practical for large files, but ok for fairly small ones. And you need to open both files in binary mode -- just … | |
Re: line 4: move it up above liine 1 line 13: for (int Hour=1; Hour <= 24; Hour++) That is wrong. Arrays are numbered from 0 to (and including) 23, so it should be written like this: [icode]for (int Hour=0; Hour < 24; Hour++)[/icode] line 15: Emp = Cust/20 + 3; … | |
Re: >>If You Want Something To Do, Try This Exercise... Ok, wrote, compiled and debugged in 22 minutes. Except I used a linked list instead of an array. (This is my day off from work so I have lots of time to spare :) ) | |
Re: read the two files into memory then call memcmp() to compare them. Or, if MS-Windows, use the COMP program (create a command window, then type [icode]c:>Help <Return>[/icode] and view the available commands. | |
Re: Probably your compiler because it worked ok for me after correcting the header files as previously explained. | |
Re: [QUOTE=jephthah;882237] but the memory has not been [B]allocated[/B], so if you try to modify it the resulting behaviour is undefined. .[/QUOTE] The problem is NOT that memory was not allocated for the string (actually it was), but that the string resides in (probably) read-only memory, depending on how the compiler … | |
Re: You might want to put code guards in that header file to prevent the problem you describe. [code] #ifndef POINTS_H #define POINTS_H struct Points { int xCoordinate; int yCoordinate; int zCoordinate; }; // end of struct Points definition #endif [/code] | |
Re: you need to allocate one more byte than file size for the string's null-terminator, then add the null terminator after the read() operation. [code] char* data_block=new char[(int)size+1]; file.seekg(0,ios.beg); file.read(data_block,size); data_block[size] = 0; file.close(); [/code] | |
Re: [QUOTE=azjherben;879662]Page not found?[/QUOTE] try the links again -- they worked ok for me. | |
[URL="http://www.youtube.com/watch?v=bhcA4Ry65FU"]Happy Mother's Day [/URL]to all you moms out there. :) ;) Us guys couldn't survive without you. [URL="http://www.youtube.com/watch?v=HAxfh8ukosQ"]Narue on Mother's Day[/URL] | |
Re: [QUOTE=Aia;876925]Since you didn't care to express your opinion in a decent post, allow me to copy it for you, so I can make a reference to it. What do you mean by "I rarely give bad rep except here"? What prompts you to give a bad rep here? Why is … | |
Re: I assume you want to pass the entire array to that function, then don't specify the array size. I'd also pass the element number that you want used in the sprintf() call. [code] void DisplayPoints(Point point[], int index){ sprintf(xCoordinateText,"%.0f", point[index].xCoordinate); BasicFunctionsCode.render2DBitmapText(1080, 100, font, xCoordinateText); } // end of DisplayPoints [/code] | |
Re: You can execute another program on PPC the same way you do it on a PC. CreateProcess() win32 api is one way. Remember, PPC does NOT have a command prompt, so system() is not available (as I recall). There is also no such concept as [b]current working directory[/b] or [b]change … | |
Re: [QUOTE=Topi Ojala;880523]Quick, before the mods get here! Add the code tags ![/QUOTE] Its not really worth the effort :) | |
| |
Re: You could go to your CONTROL PANEL --> Edit Options and uncheck this option box. Other than that there is little that we can do about it. [quote] you can allow other members to send you email messages. [ ] Receive Email from Other Members [/quote] | |
Re: >>Any help ?? Yes, lots of it. But you first have to post the code you have tried. | |
Re: [QUOTE=nagu89;880679]Will both you guys please stop fighting and try helping me out?[/quote] Agree. [QUOTE=nagu89;880679]but I guess my compiler is the culprit. Guys. - Let me know of a decent compiler and where to download it[/QUOTE] You never did say what compiler you are using, or even what operating system (*nix, … | |
Re: [code] for ( int i=0;i<row;i++ ) { if (custn == customers[i].custno) { <snip> } else errorMsg("Invalid Option"); } [/code] It would appear the logic is wrong. Unless the very first item in the array is always the custn its looking for then the program will always display the error message. | |
![]() | Re: The same way std::string does it [code] class String { public: String(); String(char *str); ~String(); String& operator= (char *str); operator char* (); [color=red] const char* c_str() {return szStr;} [/color] bool operator== (char *str); private: char *szStr; }; [/code] |
Re: [URL="http://lmgtfy.com/?q=how+to+use+msado15.dll+with+c%2B%2B"]See This[/URL] | |
Re: what do you mean by [URL="http://www.google.com/search?source=ig&hl=en&rlz=1G1GGLQ_ENUS328&=&q=+c%2B%2B+magic+numbers&btnG=Google+Search&aq=f&oq="]magic numbers?[/URL] Example: [icode]int i = 123;[/icode] the "123" is considered a magic number. Is that what you mean? | |
Re: <map> doesn't allow duplicates. And with map you don't even need that structure, unless it contains other things that you didn't post here. [URL="http://kengine.sourceforge.net/tutorial/g/stdmap-eng.htm"]Example code here.[/URL] [URL="http://msdn.microsoft.com/en-us/library/e8wh7665(VS.80).aspx"]std::set container [/URL]also don't allow duplicates and are sorted. | |
Re: I tried to compile it with vc++ 2008 express and got other errors. Must be some header files missing -- I have no idea how to correct them. [quote] 1>c:\dvlp\test2\test2\debug\msado15.tlh(2375) : error C2059: syntax error : '<L_TYPE_raw>' 1>c:\dvlp\test2\test2\debug\msado15.tlh(2375) : error C2238: unexpected token(s) preceding ';' 1>c:\dvlp\test2\test2\test2.cpp(27) : error C2065: '_RecordsetPtr' … | |
Re: [QUOTE=iamthwee;880804] Those links at the top leads me to believe this is just a cheap attempt to spam and yes if you look at his post history that confirms it.[/QUOTE] spamy links don't necessarily make the entire post spam. | |
Re: I guess its time for you to toss what you've done into the bit bucket and do it again the right way. | |
Re: why did you bother creating that pointer just to pass to a function? All you have to do is pass string's c_str() [icode]WriteFile(str.c_str());[/icode] >>line #9: cin.widen('\n') What is that supposed to do -- unless you compile for UNICODE it will do nothing. Seems more reasonable to just do this: [icode]getline … | |
Re: lines 13-40 do the same thing over and over for 81 times!:icon_eek: What's the point of doing that? delete line 12 because lines 13-40 initialize the array with other numbers. lines 61 and 64: what is [b]comp false;[/b] ? There is no such thing as [b]comp[/b] | |
Re: Stay away from those pointers. lines 8-10: delete those lines lines 16-18: [code] p.push_back(string("s1")) ; p.push_back(string("s2")) ; p.push_back(string("s3")) ; [/code] With the above changes you don't have to worry about a destructor because the vector and string classes with destroy themselves. | |
Re: If you post something in the wrong forum, just hit the "Flag Bad Post" blue link and request a mod to move it to somewhere else. We realize people are not perfect and sometimes make mistakes. You will not get any grief from any of the moderators if you ask … | |
Re: variable [b]password[/b] is only a single character, which means it will accept only one character. If you want it to accept many more characters then declare it as an array of characters, or a std::string object, like this: [icode]char password[255] = {0};[/icode]. That lets you type up to 254 characters … | |
Re: If you read all that data into memory at the beginning of the program you can then write a simple function to display the information. [list=1] [*] create a structure that contains each of the fields in the file [*] read the file into an array of structures [*] use … | |
Re: how do you know it does not convert the entire file? Did you write another program to read back all that binary data and compare it with the original file? | |
Re: probability of what? Apples are red? Sky is blue? Grass is yellow? How is the probability variable calculated? Just a random number? So you want to increment the counter if there is a 50-50 chance of something happening? | |
Re: If you have to write your own sort function, google for "sort algorithms", or for "bubble sort" | |
Re: You failed to write the Array class's constructor implementation code. [code] #ifndef ARRAY_H #define ARRAY_H #include <iostream> using namespace std; template < typename B > class Array { friend ostream &operator << ( ostream &, const Array < B > & ); friend istream &operator >> ( istream &, Array … | |
Re: post a small example program that has the problem you describe because I don't quite understand what you are talking about. | |
Re: >>I thought the discussion forum was for suggestions. It is -- but you didn't post a suggestion. Geek's Lounge is where you can post silly and/or off-topic stuff. About the only time you will get kicked off there is if you post technical support questions, profanity, porn, advertisements, or flame … | |
Re: [URL="http://www.programmingforums.org/thread22226.html"]Sane [/URL]on PFO posts monthly challenges. You could join in there with your own challenges. | |
Re: continue program exception in the catch block. [code] void foo() { cout << "foo() is throwing an excetption\n"; throw 1; } int main() { try { foo(); } catch(...) { cout << "Exception caught\n"; } cout << "Ending program\n"; } [/code] Output is this: [quote] foo() is throwing an excetption … | |
Re: [URL="http://lmgtfy.com/?q=c%2B%2B+connection+to+oracle"]this is soooo difficult![/URL] | |
Re: [quote]Any extra work is strictly optional, for your own benefit, and will not directly affect your grade[/quote] Bummer!:( | |
Re: I would have done it slightly different what what William posted -- initialize the value of [b]num[/b] with the first element of the array on line 10, then line 21 of his code could be deleted. | |
Re: you mean a wireless device such as a cell phone or barcode scanner? I would imagine it would depend on the compiler and the device type. I've done programming with Mobile 5.0 and Pocket PC operating systems on a barcode scanner (Symbols and Intermec) Those two scanners have completely different … | |
Re: you will have to post bintree.h if you want anyone to compile and test your code. | |
Re: That compiler can build GUI programs in which you can draw circles, rectangles, and other graphic shapes. Does your teacher expect graphic shapes or text shapes ? Are you in a first year programming class ? If yes, then I suspect your teacher only expects text shapes because graphic shapes … | |
Re: line 6 is unnecessary. you are not null-terminating the destination string. wcslen() returns the number of characters in the string and does not include the null terminator. So add a line after line 10 to null terminate the destination string. You could also have just used wcscpy() and not bother … | |
Re: k does not loop at all. Its only an integer that sums up the values of j in the last iteration of that i loop. So the final value of k should be 3 + 0 + 1 + 2 + 3 = 9. |
The End.