15,300 Posted Topics
Re: MIN and MAX won't really be of much value in your program anyway. First use pencil & paper to find the minimum value of the 5 scores. That will give you a clue how to write the program. You would set the initial minimum value to be the value of … | |
Re: I have no idea what you want. >>can help me? Can we help you do what? | |
Re: you can delete score1, score2, ... score5 from the class because they are not needed. You can initialize a vector with 5 integers by using its resize() method [icode]scoreList.resize(5);[/icode] and each element is initialized to 0. So the constructor reduces to this: [code] ScoreChop::ScoreChop() { loScore = 0; avgScore = … | |
Re: you can also do it like this: [code] char inbuf[255]; // allocate array of 10 pointers and initialize them all to 0 char* pString[10] = {0}; int i; for(i = 0; i < 10 && fgets(inbuf, sizeof(inbuf), spIn+i) { // allocate memory for the string pString[i] = malloc(strlen(inbuf+1); // copy … | |
Re: What you should have coded is an array of 5 STUDENT structures. Each structure holds the information for just one student [code] typedef struct { int id[5]; char* name; int quiz1; int quiz2; int quiz3; int quiz4; int exam; } STUDENT; [/code] [code] int main() { STUDENT students[5]; // Statements … | |
Re: [QUOTE=sarehu;644957]There's nothing wrong with gambling.[/quote] Not if you are a millionaire or better and can afford to constantly lose. The problem is that most gamblers are not wealthy and can't afford to lose. So, yes, there is a lot of things wrong with gambling for those who don't know when … | |
Re: you need to code it something like this -- it has to call fgets() for every line in the file. fgets() only reads one line of the file, not an array of lines. [code] while( fgets(buf, sizeof(buf), fp) != NULL) { // now do something with this line } [/code] | |
Re: [URL="http://www.wotsit.org/"]This [/URL]would seem to be a good place to begin your research. | |
Re: >>I am using Dev Cpp for dos programming No you are not. MS-DOS died 10 years ago. What you mean is that you are doing console programming. If you want nice looking gui menus and mouse support something like what you have in your browser then you have to learn … | |
Re: >>I guess all of you know this message.. No I don't. Post the exact error message instead of making us guess. what compiler and os are you using? Learn to use your compiler's debegger so that you can step through the program one line at a time to see its … | |
Re: Go back to the Microsoft site where you got that compiler and it will have link(s) to tutorial(s) about how to use the IDE. It takes a little practice, but you should bet the basics right away. Just remember, VC++ 2008 Express is NOT Turbo C++, so don't expect to … | |
Re: What operating system? Under MS-Windows you can't achieve that goal with the system() function because it doesn't return anything about the process that was started -- steam.exe in your example post. Instead, use win32 api function [URL="http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx"]CreateProcess[/URL](). The last parameter will be filled in with the information you need to … | |
Re: Welcome to DaniWeb. See [URL="http://www.daniweb.com/forums/forum72.html"]these links[/URL] | |
Re: Did you try to use a different name? Is [b]filename[/b] a reserved word in FORTRAN (and is FORTRAN case-insensitive) ? Also, did you make the C function the correct calling convention for FORTRAN? [URL="http://msdn.microsoft.com/en-us/library/aa278672.aspx"]Here[/URL] are the available options. | |
Re: Welcome to DaniWeb where you will find several of us old dinosaurs :) As for your question, please post on one of the Tech Talk boards. | |
Re: Welcome to DaniWeb. Sorry but I had to cut out your email -- against the rules to post them. | |
Re: >>listView2->SelectedIndices SelectedIndices is not an integer -- its an array of integers. listBox1->SelectedIndices->Count is probably what you want. Did you see the example c++ [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.selectedindices.aspx"]Microsoft code here[/URL] Read the comments carefully. [code] private: void FindAllOfMyString( String^ searchString ) { // Set the SelectionMode property of the ListBox to select multiple … | |
Re: I wonder if Isonis got his computer fixed or replaced. | |
Re: The first parameter to fread() must be a pointer. What you are attempting to pass is an integer. Use the pointer & operator and it should fix that. That is inteded to read the binary version of an integer, not the text version. If the file is a text file … | |
Re: On client, send the object just like you would send any other blob, then on client recreate it from the blob. Probably something like below. Make sure the class has an overloaded = operator for this to work. [code] // server MyClass object; ... send(socketID, &object, sizeof(MyClass)); [/code] [code] // … | |
Re: line 15: does nothing so you might as well delete it. The loop lines 14-25 can be rewritten like this: [code] char word[20]; while(1) { cout << "Enter a word which includes NO i's : "; cin >> word; if( strchr(word,'i') ) { cout << endl << "I asked for … | |
Re: [QUOTE=sambafriends;647806]Hi, I want the difference between procedural programming language and opps languages with beautiful example ,[/QUOTE] I think you are confusing terms -- oops is not the opposite of a procedural language. An "event driven" language is the opposite of procedural. procedural: the program executed from top down with loops … | |
Re: I've had lots of those wow moments -- especially after a few drinks of alcohol. Warning! alcohol and coding don't mix :) | |
Re: My guess is that MS-Windows treats pen events just like mouse events -- there is no difference between the two. | |
Re: This is something like how to code the program to read each line of the file. [code] #include <iostream> #include <fstream> #include <sstream> using namespace std; ... ... ifstream in("filename.txt"); std::string input; float timestamp,latitude, longitude, altitude; while( getline(in, input) ) { // split it into individual parts stringstream str(line); str … | |
Re: Welcome to DaniWeb. >> I have done my very best to keep grammar and punctuation at a proper level In that case you have done a lot more than most of us. Don't worry too much about grammer, few, if any of us, are English majors in college. We don't … | |
Re: I have no idea what you want! A program that shows its input data is garbage? What kind of statement is that supposed to be??? | |
Re: cin wants a reference to an integer, and getDay() just returns an int. If you change getDay() to return a reference then readDate() should work correctly. Example: [code] class Date { ... int& getDay() {return m_day;} }; [/code] | |
Re: [QUOTE=guy40az;430059]I am using Visual C++ version 6. I need to know how to add a .lib file to a project. I want to add it as a static lib file.[/QUOTE] Project --> Settings --> Link Tab --> change Catetory to [b]Input[/b] then add the library to the [b]Object/library modules[/b] list. … | |
Re: >>f.write(str_name.GetBuffer(str_name.GetLength()),str_name.GetLength()); This will not help the problem you describe, but you should be using the >> operator for that, not the binary write() function. [icode] f << (LPCTSTR)str_name << "\n";[/icode] Note that you don't need to call GetBuffer() because CString has overloaded the LPCTSTR operator that does similar thing -- … | |
Re: >>or maybe i should just remove the '&', but thought it's a good practice to pass reference params Don't remove the & because open streams must be passed by reference. | |
Re: I doubt the singer would make it on American Idol (or whatever its called in UK). | |
Re: [QUOTE=Shadoninja;646691]Why would I go into a C++ reference and go looking for the command when someone like you could clearly help me quicker[/QUOTE] Because, give you bread and you may eat for one day, but teach you how to grow food and you will eat forever. Yes, Narue, or anyone … | |
Re: look at local area colleges -- there muist be one nearby. | |
Re: When I attempt to do that from a command prompt I get that same error because there is no such thing as "%0...". Where did you get the idea of that %0 from anyway? | |
Re: >> delete[] str; //delete the Candy to avoid memory leak Don't do that because you don't know where str is allocated. The caller may call that function several ways, so its best to leave it up to the caller to delete the string when necessary. Any of the following sanerios … | |
Re: 1) Array elements start counting from 0, not 1. That means the first element of Total is Total[0] and loop counters should count from 0 to but not including the number of elements in the array. Example: The loop counters beginning on line 58 should be (and that's how I … | |
Re: >>It is possible for the ActiveX, to open a choose folder dialog? I don't see why not, as long as the computer is running MS-Windows >>How I send the content(files) to the server? It would seem to be that the transfer process would be greatly improved if you would zip … | |
Re: >>No where in the program they have used X. But it has -- its used in the macro Y | |
Re: You do not need ODBC. Just open the text file with standard fstream object. Text files do not need connection strings like SQL databases such as MySql. If your looking to learn ODBC, there are tons of c++ classes, some free and some not free. Just google for them and … | |
![]() | Re: I don't see a proglem with that code snippet. Key loggers have both legal and illegal uses and the code snippet makes no comment about either. The code snippet used perfectly legal and publically documented functions and there is no intent to being sneeky about it. |
Re: [code] int main() { HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd, SW_HIDE); } [/code] | |
Re: You didn't look very hard did you? [URL="http://www.daniweb.com/forums/thread134017.html"]Click here.[/URL] | |
Re: A c++ compiler will produce errors on that code because in order to overload a function the parameters must be different. In the code you posted both versions of the function have the same identical parameters. So your question is moot because that code can not be compiled. | |
Re: Oh gee -- that sure took a loooong time to find. [URL="http://www.google.com/search?hl=en&q=how+to+get+ip+address+from+host+name"]Learn to use google[/URL]. | |
Re: You can look at the [URL="www.datareel.com"]DataReel[/URL] libraries. It is a set of lots of c++ classes/programs/examples that have been ported to both *nix and MS-Windows, and supports all the popular compilers on both operating systems. It has support for client/server architecture, but I don't know if that's what you are … | |
Re: line 33: buffer is a character array, therefore it will never be < 0 and that while loop makes absolutely no sense. | |
Re: The second version is actually illegal because the object being returned is created on the stack, and that object is destroyed when the function returns, therefore it will not exist and the returned reference will be invalidated. The first version (without reference) is ok because the program will actually duplicate … | |
Re: convert all the calculations to floats and it will work. as integer, 1 * 0.2 = 0 because decimals are discarded. |
The End.