15,300 Posted Topics
Re: Well, what is wrong with the code you posted? Compiler errors/warnings? If yes, what are they? | |
Re: 1) delete all those unreferenced variables. They just clutter up your code and compiler err/warning messages. 2) after completing 1) then you can see the real errors. One of them is that you used ( when you should have used { in the opening function brace. The other is that … | |
Re: >>getline(cin, partDescrip); That should work ok assuming partDescrip is std::string. Why the program skips it is due to other parts of your program. If you have input for integers then you need to clean out the input keyboard buffer of the '\n' that is left. Right after the input integer … | |
Re: your program does not allocate any memory for the line. And your program does way too much work! This is all that is needed. [code] std::string line; int i = 0; while( i < 7 && getline(inputfile, line) ) { i++; } cout << line << "\n"; [/code] | |
Re: lines 1, 10, 15, 23, 31, 50, 71, 95 and 100 are comments. So how is that related to the subject of this thread ? | |
Re: [icode]int level = atoi(argv[2]);[/icode] | |
Re: Maybe you need to upgrade your GF to a newer model :) [quote] Some girlfriends do not need upgrading... just proper maintenance. However; if you have chosen a model that is not compatible with you, or if you have chosen a model that is beyond your means to afford/perform the … | |
Re: First you will have to change the DLL to accept the parameters that you want. That means you will have to recompile the dll with the new set of parameters. | |
Re: I only carry one credit card -- leave the other one million cards on my bedroom dresser. I carry it to buy gas and other things I see while shopping. Then I always pay the entire balance when I get the bill so that I don't have to pay intgerest. | |
Re: [URL="http://www.microsoft.com/express/vc/"]vc++ 2008 Express[/URL] [URL="http://www.bloodshet.net"]Dev-C++[/URL] I know there are others. All C++ compilers also compile C code, so you don't need separate compilers for that. For more information and helpful stuff see the [b]Read Me[/b] threads at the top of the C++ board. | |
Re: depends on how fancy you want the print job. [URL="http://www.codeproject.com/KB/printing/printingmadeeasy.aspx"]Here's one solution[/URL] that does not require MFC. That site has other c++ classes so just put "printer" in their search bar. | |
Re: how is accountNumber declared? delete line 12 because the previous loop copies the null terminator into the array. | |
Re: Its better to not write assembly language at all -- just let the compiler do the work for you. There is little, if anything, to be gained by hard-coding assembly language into a c++ program. And it makes porting to other operating systems next to impossible. | |
Re: lines 214-218: This will not work because the [b]new[/b] operator does not return 0 when memory allocation fails -- it throws an exception. If you want to check for that then you need to use try/catch blocks. The code you posted is a good example of the MISUSE of unions. … | |
Re: you are missing a header file -- see example program [URL="http://msdn.microsoft.com/en-us/library/ms738520.aspx"]here[/URL] | |
Re: how did that even compile? It is missing two closeing } character. Assuming that is just a posting error the code looks ok to me. | |
Re: TextPad is not an IDE for compilers, but just a text editor. If you want to learn c++ then use a real compiler, such as free [URL="http://www.microsoft.com/express/vc/"]VC++ 2008 Express[/URL] | |
Re: since this is c++ why use pointers? Just make name and message both std::string and that will probably solve the memory leek problemn. | |
Re: The >> operator stops at the first space. To get everything you need to use getlin(). There are two versions: one for std::string and the other for character arrays. [code] cout<<"ENter name"<<endl; getline(cin, name); // assum name is std::string cin.getline(name, sizeof(name)); // assumes name is a character array [/code] | |
Re: I hope your boss knows that and is rewarding you handsomly for spending so much time at work. Are there shower facilities there too ????? Don't want your boss and other people thinking there is a dead mouse rotting in that room :) | |
Re: The program won't work if the file has fewer than [b]line[/b] number of lines. Here's one way to correct that [code] int i = 0; while(i < line && getline (current_file, current_line)) ++i; if(i != line) // if error return ""; // return blank line return line; [/code] | |
Re: >>Does CWnd::GetClientRect() include the toolbar region? Not sure if it does or not. Try using CWnd::GetWindowRect() and see if that fixes the problem. | |
Re: The problem isn't the boy -- he's not old enough to give consentual sex. But the teacher will probably spend several years behind bars, spend the rest of her life on the sexual offense roster, and her teaching career is over. She runed her life for a few minutes of … | |
Re: Your last statement is how its normally done. Create one object then call all its methods as necessary. If you declare the methods static then you don't have to create an instance of the object in order to call the function [code] class A { public: static int getBeta(); }; … | |
Re: Maybe you are using the wrong compiler. [URL="http://www.microsoft.com/express/vc/"]Download VC++ 2008 Express [/URL]and compile your program for UNICODE (which is the default with that compiler) | |
Re: line 36 in your post should be [icode]int FHF::m_id = 0;[/icode] You have to declare it with a data type just like you would any other global variable. | |
Re: using ctime functions will consume a lot of CPU time. Instead its better to call the os Sleep() function (MS-Windows) or sleep() (*nix). [code] #include <iostream> #include <windows.h> int main() { while(true) // infinite loop { system("start alarm.wav"); Sleep(30 * 1000); // delay 30 seconds } } [/code] | |
Re: I don't get that problem with either IE7 (64-bit version) or FireFox version 3.0.3 | |
Re: Error 1: that error message always means that you have mis-matched { and } or parentheses. Count them and make correction. Error 2: correct error #1 and this will be fixed too. | |
![]() | Re: word alignment -- [URL="http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Data/aligned.html"]click here[/URL] >>Which Library do we work perfectly with a big integer There are no standard c or c++ libraries that will do that. But [URL="http://www.google.com/search?hl=en&q=large+integer+libraries&aq=f&oq="]click here [/URL]for others. |
Re: >>.I am re-posting my code This is your first post -- so how can that be ??? >>The code runs correctly, but the ending balance, after all the withdrawals, is incorrect Then it doesn't run correctly, now does it?? What compiler are you using? VC++ 2008 Express produces a couple … | |
Re: lines 13 and 14 are in reverse order. The { goes after the while statement, not before. line 28 -- break -- is wrong because it is not inside any loop where a break is valid. Here is how the function should work [code] top of loop enter variable x1 … | |
Re: You have to download and install the [URL="http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43-E24F-4EA3-A93E-40C0EC4F68E5&displaylang=en"]Windows Platform SDK [/URL]free from Microsoft. Or download and install[URL="http://www.microsoft.com/express/vc/"] VC++ 2008 Express[/URL], which has what you need. | |
Re: About program formatting: Don't write a program that is straight down the left-hand side of the screen like you have posted. Indent the lines so that they are easier to read and understand. About functions -- [URL="http://computer.howstuffworks.com/c12.htm"]see How Stuff Works[/URL] | |
Re: you can not copy one character array to another using the = operator -- that only works with std::string. The assignment wants you to copy the string in reverse order. The only way to do that is one character at a time, something like you did in the previous line … | |
Re: >>Dudes Wuudup?? This isn't a chatroom. Write in English, not some sort of chatroom talk. Assuming the target operating system is MS-Windows, [URL="http://www.winprog.org/tutorial/"]read this tutorial.[/URL] | |
Re: line 28: remove [b]void[/b] -- when calling a void function just have (), such as [icode]displayMenu();[/icode] line 40: function name is misspelled. Check capatialization. | |
Re: Your program has mismatched { and }. If you would use better formatting then such errors will be easier to find. As it is, it is very difficult and time consuming to find matching { and }. Here is an example of what I suggest: [code] for(i=1; i <= totalDates; … | |
Re: If the user keys in more than just a single character you can flush the input keyboard buffer of all remaining keystrokes. See [URL="http://www.daniweb.com/forums/thread90228.html"]Narue's article here[/URL] about how to do that. | |
Re: line 8: you have to declare a variable name inside the parentheses. line 26: [b]else[/b] should not be capitalized. | |
Re: write a recursive function to print the numbers. | |
Re: Post the line of code that caused that error because I'm not a mind reader or clairvoyant. | |
Re: He is asking you to write two functions named [b]min[/b] -- The parameters to one of the functions will be two integers, while the parameters to the other function will have three parameters. That is called function overloading -- more than one function with the same function name but different … | |
Re: I don't think it would work here because it would not have enough traffic to make it viable. DaniWeb is devoted to IT related issues. I'm sure you can find other suitable web sites for help with electrical engineering. | |
Re: The input file is opened in text mode, which means your program will never see the '\n' character(s) because getline() will filter it out, leaving only the characters up to but not including '\n'. That read loop is wrong anyway because eof() doesn't work that way. [code] while (getline(infile, tmp)) … | |
Re: you need to use the win[URL="http://msdn.microsoft.com/en-us/library/aa363196(VS.85).aspx"]32 api communications functions[/URL] | |
Re: C and C++ do not have "END IF" statements. [code] int score; char grade =0; // read in total score cout << endl; cout << "Enter total score (float, must be <= 100): "; cin >> score; if (score >= 85); grade = 'A'; else if (score >= 75); grade … | |
Re: Are you doing command-line builds or building in the IDEs ? If command-line builds then you have to set up the environment for each compiler by running the vcvars32.bat file in the compiler's bin directory. |
The End.