1,174 Posted Topics
Re: [QUOTE=Wza;593512]Or use a vector, which you can add to arbitrarily std::vector< std::string > studentID; fin >> aStudent; studentID.push_back( aStudent );[/QUOTE] You need to add [icode]std::string aStudent;[/icode] | |
Re: You can use ifstream for that purpose. Assuming that you have a file named numbers.txt (containing numbers), you could read it as follows [code] ifstream infile("numbers.txt"); int nn; while( infile >> nn ) // Read one number at a time { printf("%d\n", nn); // Display the number read } [/code] | |
Re: Use $? to catch the program's exit code, see [url]http://www.gnu.org/software/bash/manual/bashref.html#Special-Parameters[/url] | |
Re: It might prove helpful if you post the code showing how you actually are using strings ... | |
Re: You are misusing the form class, you instantiate two objects of the Blank class in your code. And you need to set the window text prior to showing the form ... [code]private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { // A single instance of Blank needed in this function Blank BlankFrm; … | |
Re: [code]float AverageGrade(Student[], int nStudents) { // This function receives the array Student[], why are you not // using it here at all? int i=0; float sumofgrades=0; float ave; // sumofgrades is zero at this point, since you initialized it to zero // couple lines ago ... // so you end … | |
Re: Are you sure that your input string is null terminated? | |
Re: [QUOTE=Moporho;591137] >>function named swap that takes exactly three arguments (the array name and the two >>subscripts of the array whose values are to be swapped). >>The swap function should not return any value. >> Add both the prototype and the definition of swap to the program. Your prototype's subscripts are … | |
Re: [QUOTE=L31chH4rdT;587953] I need to get a text file and insert each character into a seperate node in a linked list [/QUOTE] You don't need the dnode construct actually, instead you can simply use std::list<char> myList; [code] #include <iostream> #include <fstream> #include <stdlib.h> #include <list> using namespace std; void loadFile(list<char> &myList, … | |
Re: runMatrix is a member function of library, so you need to either 1) instantiate an object of that class and call it like libraryObj.runMatrix(...) or 2) if the runMatrix is a static function, then call it like library::runMatrix(...). | |
Re: Use the BIF_BROWSEINCLUDEFILES flag in the BROWSEINFO's ulFlags member. [url]http://msdn2.microsoft.com/en-us/library/bb773205(VS.85).aspx[/url] | |
Re: [QUOTE=jimJohnson;586743]having a little bit of a problem running the output file [/QUOTE] Could you be more specific about the problem(s)? | |
Re: ofstream is unaware of the CString type, you can cast the CString... [code=c++] ofstream data("..."); data<< (LPCTSTR) str; [/code] | |
Re: >>It is changing the position from which the string should be read but z compare is not successful. I don't quite understand that, but with regard to the search itself, you are quite close to a solution. However, in order for the binary search to work, the data (your Institute[] … | |
Re: Change [code=c++] char sk[4][4]; [/code] to [code=c++] char sk[16]; [/code] | |
Re: You are probably trying to copy memory to a destination which is too small in size. At the time that assertion fails, you may find the offending piece of code by viewing the call stack. | |
Re: [QUOTE=Black Magic;585092]When i choose to use square root, i input the number then it outputs my answer but after it it prints the case default?[/QUOTE] It appears that it would print 'WRONG DECISION.' when using square root, because effectively you have the following construct [code] if( boolSqrt == 'N' || … | |
Re: That will not work because the elements in 's' are vector<string> vectors themselves, ostream operator << has no support for that kind of thing by default. If you really want to pass e.g. a vector<string> to cout, you can write; [code]ostream & operator <<(ostream & o, const vector<string> & v) … | |
Re: The linker complains because it cannot find definition for static const byte q[2][256]; static const word32 mds[4][256]; Try downloading the complete crypto++ library in one .zip file from e.g. [url]http://gd.tuwien.ac.at/privacy/crypto/libs/cryptlib/cryptlib.v42.html#download[/url] | |
Re: See "Port I/O with inp() and outp() Fails on Windows NT" [url]http://support.microsoft.com/kb/112298[/url] You may find this interesting [url]http://www.beyondlogic.org/porttalk/porttalk.htm[/url] | |
Re: Implement the timer proc outside the CServiceModule class. I.e. you will have [code]VOID CALLBACK ::TimerAPCProc(...)[/code] instead of [code]VOID CALLBACK CServiceModule::TimerAPCProc(...)[/code] | |
Re: Sorry to say, but you seem to have the very basics of C++ pretty much mixed up. I'd really suggest you to pick up your text book and take your time to go through it from the beginning. | |
Re: The code looks strange (I'm in a hurry now and can't explain in details), anyway try something like; [code] form2 frm; frm.ShowDialog(); MessageBox:: Show(frm.textBox1->Text); [/code] | |
Re: niek_e got there first ... | |
Re: I would suggest - first try the 'VCExpress /resetskippkgs' command (after you have located where VCExpress.exe is on your system) - post your problem to the following forum: [url]http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=26&SiteID=1[/url] and see what they say. (They seem to answer pretty quickly) BTW, after having taken a look at some of the … | |
Re: Try searching daniweb for "prime numbers", there ought to be many matches ... | |
Re: Just a note, you should hide the constructors so that there is no possibility to have more than one instance of the class (i.e. make it truly singleton). Then, an alternative to get/create the instance is; [code] myClass & myClass::getInstance() { // The one and only instance ever created static … | |
Re: Like Ancient Dragon already stated .. [QUOTE]Write the program just a little bit at a time so that you don't get overwhelmed by the length of the assignment. [/QUOTE] So, try divide and conquer the problem. It doesn't even have to be solid code but instead you can try and … | |
Re: [QUOTE=ericisshort;584711]because I have no idea where the problem is[/QUOTE] Here is one link that might get you started [url]http://www.cprogramming.com/debugging/segfaults.html[/url] | |
Re: Regarding books, one link is ... [url]http://www.daniweb.com/forums/thread70096.html[/url] | |
Re: If you want to keep using the array 'char s[100]', you can explicitly copy the ostringstream's content into the array. I.e .. [code] strcpy(s, outs.str().c_str()); [/code] Or use the >> operator, i.e. [code] outs >> s; [/code] | |
Re: You cannot do it like that, 'word' is there a pointer to a char. So, try with an array of chars instead [code]char word[21] = ""; scanf("%20s",word); // at max, 20 characters get scanned to the 'word' [/code] | |
Re: I suppose you are using the personalAccount somewhere, could you post that code, i.e. if you have e.g. something like [code]int main() { personalAccount Account; ... [/code] | |
Re: [QUOTE=programmer321;580562] on linux platform, After sending the signal SIGINT using cntrl+C, the numbers are printed from 1 to 100000. In case I press cntrl+c again during the time my code is executing the for loop for pirnting numbers between 1 and 100000, it doesnt have any effect on the printing. … | |
Re: The problem is that there probably is no [B]definition[/B] of the variable muscleTendonLength anywhere (hence the linker really is unable to do its job). See [url]http://c-faq.com/decl/decldef.html[/url] and place the definition [code]dpMuscleTendonLengthStruct* muscleTendonLength;[/code] somewhere suitable in your code. You may also want to initialize the definition of muscleTendonLength to e.g. NULL. | |
Re: [QUOTE] Don't i have to include some libraries in the project->link tab for example ? [/QUOTE] Yes you have to, you will be using the bgd.lib import library for that purpose. At run-time, your program will then use the bgd.dll. But first you really have to create the bgd.lib import … | |
Re: You need to tell the IDE to link with the Winmm.lib library also, so open Project/Properties/Configuration Properties/Linker/Input and append winmm.lib in the Additional Dependencies field. Also, use the first block of code you've tried, i.e. PlaySound(TEXT("test.wav"), NULL, SND_ALIAS | SND_APPLICATION); | |
Re: [QUOTE=Adrian99420;579044] So, I juz wan to make a simple file browser function to add the "name(string)" of file selected into the combobox. [/QUOTE] Then you can probably use the GetOpenFileName function, see [url]http://msdn2.microsoft.com/en-us/library/ms646927(VS.85).aspx[/url] | |
Re: I think you need to understand what a function is and how to use one, here is a short basic tutorial [url]http://www.cplusplus.com/doc/tutorial/functions.html[/url] and [url]http://www.cplusplus.com/doc/tutorial/functions2.html[/url] | |
Re: Try taking a look at here [url]http://en.csharp-online.net/CheckedListBox[/url] to get an idea about what a multicolumn listbox is. | |
Re: Try valgrind [url]http://valgrind.org/info/[/url] As a general note, you should add error checking to your code. As of now, there is none. | |
Re: You have a major problem regarding scope of variables in C/C++. Lookup and study information on that subject very closely. Even better is, if you make simple tests to really understand how variables (including arrays) get created and destroyed in a program. Instead of pointing out the errors in the … | |
Re: Are you sure that the file actually contains any data? A minor note, in your 'case 7' block, the 'continue;' is inside the if block which checks whether the infile is open, you should move 'continue;' outside of the if block. | |
Re: What do you mean by [QUOTE=tgiboss1;568787] [B]load[/B] this external [B]exe[/B] and [B]display it [/B]within that control window [/QUOTE] | |
Re: You haven't removed the file(s) from the project I guess, so select the desired file in the workspace window's file tree and press Delete. | |
Re: Like vijayan121 already pointed out, you need to use the Show() method instead of the ShowDialog(). So try ... [code] private: System::Void button2_Click_3(System::Object^ sender, System::EventArgs^ e) { this->form22instance.Show(); this->form4instance.Show(); } [/code] | |
Re: About fflush(stdin); see [url]http://www.gidnetwork.com/b-57.html[/url] | |
Re: I think you could use directly the IndexOf() method, i.e richtextBox1->Text->IndexOf("how") and once you get the index (or -1, if not found), you probably already know how to select the text in a TextBox. | |
Re: For a single error (ERRORC) it goes like this ... [code]do { // do something ... } while(-0.1 > ERRORC || 0.1 < ERRORC);[/code] | |
Re: Because of the way how you use _itoa_s(...) and the related buffers, _score, _tempscore and val, the program runs currently on good luck. You could change all the _itoa_s() calls to use a single array of chars of sufficient size, i.e. [code]static char itoa_conv_buff[MAX_BUF_LEN_HERE]; _itoa_s(num, itoa_conv_buff, MAX_BUF_LEN_HERE, 10);[/code] |
The End.