15,300 Posted Topics
Re: One problem is that you included <string> but failed to specify std namespace. line 975: [icode]std::string blabla[/icode] | |
Re: And what specifically is the problem? The only thing I see wrong is that you need to prototype each of those functions that are being called in that switch statement. Otherwise looks like it should compile and work ok. | |
Re: It won't compile because you commented out a class method in the header file. Look at the error line number, then look at the header file to see where that function is declared. Its commented out! | |
Re: put all the operators in a character array then use strchr() to see if a character is one of the operators. [code] const char operators[] = "/*+-()"; while( !empty_optr() && ischar(operators, top->data_optr)) { // blabla } [/code] | |
Re: [URL="http://lmgtfy.com/?q=jpeg+image+file+format"]Try this[/URL] | |
Re: [code] while(!fis.eof()) { lines2++; fis >> str; } [/code] two problemss: 1) that counts the number of words, not lines. If you really want lines then call getline() 2) That will count the last line/word twice because eof() doesn't work lilke that. Here's how to code the loop [code] while( … | |
Re: Post your version of that file. Mine doesn't have INT64 on line 17. Or maybe you should use a different compiler, such as free Microsoft VC++ 2008 Express. | |
Re: So you think we are going to tell you how to write a bot to spam everyone, including DaniWeb? :D | |
Re: do you mean something like [icode]system("cd ..");[/icode] ? | |
Re: 1) you could store them in different directories. 2) extract a file, rename it, then extract another file. Do that for each of the zip files. | |
Re: you could always copy/paste into your own favorite editor, such as Notepad++ which will do what you are looking for. | |
Re: I don't know the purpose of all those for loops. If all you want to do is erase the '~' characters then just do that [code] for(int i = 0; i < inp.length(); i++) { if( inp[i] == '~') inp.erase(i,1); } [/code] | |
Re: Do you have write permissions on that computer and directory? Try to copy manually and see if it works. | |
Re: I think it would be easier to validate user input by getting it as a string then validating the string. For example, if I type "122abv234", scanf() will only pick up the first three characters and ignore the rest with no warning. But if you validate that as an array … | |
Re: never heard of ragnarok, but I played Diablo LOD for many years until I installed Vista -- won't play on Vista. | |
Re: [QUOTE=ithelp;815365]Sometime newline ends with ^M .[/QUOTE] Its not a matter of "sometimes". It either does, or it doesn't, depending on the operating system. '\n' translates into whatever the operating system uses as end-of-line. MS-Windows: "\r\n". *nix: "\r". Not sure what MAC uses. | |
Re: you can't call the constructor like you did in main()) [code] int main() { Bicycle myBike(24,17); myBike.printBicycle(); return 0; } [/code] | |
Re: I assume [b]table[/b] is an array of integers? Yes? If you want the numbers aligned up right then add width fields [icode]printf(output, "%10d %10d", ...)[/icode] will print them right justified in a 10 character field. If you want them left justified then add - character [icode]printf(output, "%-10d %-10d", ...)[/icode] | |
Re: >>if (gross1, gross2, gross3, gross4, gross5 < THREE_HUNDRED){ That is not the right way to code it. The compiler doesn't complain because its syntaticlly correct -- the comma operator says only gross5 is compared to THREE_HUNDRED Correct the problem like this: [icode]if (gross1 < THREE_HUNDRED || gross2 < THREE_HUNDRED || … | |
Re: The two lines are different. In the first line, arrowlink is of type newNode, while in the second line it is of type q. The two statements are the same only if newNode and q are two different names for the same thing. | |
Re: The very first error message should have told you that AVLNode is undefined | |
Re: you have two objects with the same name. You can only overload functions, not data objects. | |
Re: you should have received a compile-time error on that line because it's syntically incorrect -- _T( macro is never closed, needs a ) before the comma. | |
Re: The prototypes do not match the actual functions. Compare them and you will see what's wrong. After that you should realize that you can't pass string literals as you did to those functions -- must pass a reference to std::string object. | |
Re: you can delete pointer p since its not needed [code] while (fread(&records[totalcount],sizeof(entrant),1,fp)) { if (totalcount+1 == curmax) { curmax+=memincrement; records = realloc (records,curmax * sizeof(entrant)); } totalcount++; } [/code] In C language, malloc() doesn't need a typecase. Or you could use a linked list. | |
| |
Re: 1) try commenting out large sections of code until no more leaks detected. 2) Sometimes it reports leaks that are not really leaks. such as memory allocated by MFC classes or your own code and not yet released when CrtDumpMemoryLeaks() is called. | |
Re: Please stop calling us "boss". We aren't your boss. To initialize the array to zeros: [icode]double qty[10] = {0.0};[/icode] But qty shouldn't be an array of ints instead of doubles, or are you allowed to buy fractions of sojmething? | |
Re: try this: the compare function isn't needed. [code=cplusplus] string junk; string junk1 = "cls"; while( inFile >> junk && junk != junk1) ; [/code] | |
Re: Yes, ODBC is the oldest and most widely used method, but not the fasted. There are a few free ODBC C++ classes out there too that will help simplify the job-- just google for them. | |
Re: You first have to declare variables to hold each of the numbers. Then just use the stream's >> operator to read from the file into the number [code] int SalespersonID, ModelCode, Count, Sold; ifstream in("filename.txt"); while( in >> SalespersonID, >> ModelCode >> Count >> Sold) { // blabla } [/code] | |
Re: I compiled it with VC++ 2008 Express on Vista Home and got the below output. Didn't get the error you reported. [code] In gallons/min, what is the flow rate: 1 In inches, what is the diameter of your pipe: 2 What material is your pipe made of? The materials are … | |
Re: post the input file. You probably don't need those ignore() lines, unless there is other text on each of the lines after the number. The >> operator will ignore all spaces and the '\n' line terminating character(s). | |
Re: Welcome to DaniWeb, Chris. Hope you have a lot of fun here, learn a few things, and hopefully be able to help others. | |
Re: You can't, and we normally don't either unless it villates one or more of the DaniWeb Rules. | |
Re: those error messages are correct. Did you look up those functions in msdn to see what are their parameters? If not, then you should do so. You have to be careful about those non-standard Microsoft functions. Microsoft declared many standard C functions depreciated, the c and c++ standards made no … | |
I just saw these interesting new articles on nother of my favorite sites and thought I'd share. | |
Re: I think first you have to understand how the 2nd system is going to display the values: If system 1 has 5.123 what is system2 going to do with it? should system1 send 5123, or just 5, or what? | |
Re: So what is the problem you are having? To get the average just add them up and divide by the number of grades -- 4th grade math. | |
Re: It has been my experience that windows can only be updated in the thread in which they are created. What I have done to resolve your problem is for thread2 to send a message to thread1 so that the window can be updated by thread1. See [URL="http://msdn.microsoft.com/en-us/library/ms644946(VS.85).aspx"]PostThreadMessage()[/URL] | |
Re: If you are not allowed to use vector then you will have to read the entire file, counting the line numbers as the loop progresses. There is no other way to do it. Why do you need the line count? Maybe there are alternative ways to achieve what you want … | |
Re: Are you in school, is this homework? If yes, then read your textbook and you should find the answers yourself. | |
Re: It does not caluse a memory leak, but both pointers are invalidated after the free. | |
Re: [code] // line 286: void DelRec(Passport pass[NUM],int pptNo)//definition of modifyRecord { for(int i=pptNo;i<NUM;i++) { [/code] pptNo is supposed to be the passport number of the record to be deleted. Right? If yes, then why is the for loop initializing variable i to pptNo? If you look at the addRec() function … | |
Re: I like the idea of being able to specify the number of rep points I could give someone. I'm more concerned about bad rep -- I rarely give out bad rep because I don't want to destroy their overall rep points. It would be like running over an ant hill … | |
Re: your loop is doing too much work. [code] char codes[] = "qwertyuiop"; string dCode = "wtu"; // hard-code search value for(int i = 0; i < dCode.size(); i++) { for(int j = 0; codes[j] != 0; j++) { if( dCode[i] == codes[j]) { cout << codes[j-1]; break; } } } … | |
Re: Call [URL="http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx"]EnumWindows[/URL]() to get a list of all the top-level windows so that you can get the handle to the browser window. The problem is -- how will you know which one is the browser? |
The End.