1,174 Posted Topics

Member Avatar for Wza

[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]

Member Avatar for mitrmkar
0
87
Member Avatar for Mehwish Shaikh

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]

Member Avatar for Ancient Dragon
0
177
Member Avatar for c++noobie

Use $? to catch the program's exit code, see [url]http://www.gnu.org/software/bash/manual/bashref.html#Special-Parameters[/url]

Member Avatar for c++noobie
0
155
Member Avatar for risa

It might prove helpful if you post the code showing how you actually are using strings ...

Member Avatar for mitrmkar
0
171
Member Avatar for Adrian99420

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; …

Member Avatar for mitrmkar
0
106
Member Avatar for big24fan

[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 …

Member Avatar for Ancient Dragon
0
134
Member Avatar for f_rele
Member Avatar for Moporho

[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 …

Member Avatar for Moporho
0
250
Member Avatar for L31chH4rdT

[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, …

Member Avatar for Gerlan
0
111
Member Avatar for linux0id

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(...).

Member Avatar for linux0id
0
125
Member Avatar for opendep

Use the BIF_BROWSEINCLUDEFILES flag in the BROWSEINFO's ulFlags member. [url]http://msdn2.microsoft.com/en-us/library/bb773205(VS.85).aspx[/url]

Member Avatar for opendep
0
315
Member Avatar for jimJohnson

[QUOTE=jimJohnson;586743]having a little bit of a problem running the output file [/QUOTE] Could you be more specific about the problem(s)?

Member Avatar for jimJohnson
0
146
Member Avatar for flash121

ofstream is unaware of the CString type, you can cast the CString... [code=c++] ofstream data("..."); data<< (LPCTSTR) str; [/code]

Member Avatar for mitrmkar
0
2K
Member Avatar for avi1109

>>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[] …

Member Avatar for Ancient Dragon
0
138
Member Avatar for kartouss
Member Avatar for kartouss
0
238
Member Avatar for Roebuc

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.

Member Avatar for Roebuc
0
99
Member Avatar for Black Magic

[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' || …

Member Avatar for Black Magic
0
142
Member Avatar for chihuyu

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) …

Member Avatar for mitrmkar
0
76
Member Avatar for rimmytose

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]

Member Avatar for mitrmkar
0
108
Member Avatar for Aamit

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]

Member Avatar for Salem
0
103
Member Avatar for srinivasan34

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]

Member Avatar for mitrmkar
0
221
Member Avatar for amhadi

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.

Member Avatar for ithelp
0
143
Member Avatar for Adrian99420

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]

Member Avatar for mitrmkar
0
99
Member Avatar for Andy130
Member Avatar for Jennifer84

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 …

Member Avatar for Colstel
0
625
Member Avatar for only me

Try searching daniweb for "prime numbers", there ought to be many matches ...

Member Avatar for Salem
0
101
Member Avatar for littlestone

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 …

Member Avatar for dougy83
0
282
Member Avatar for curt1203

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 …

Member Avatar for big24fan
0
98
Member Avatar for ericisshort

[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]

Member Avatar for mitrmkar
0
103
Member Avatar for ITJohn89

Regarding books, one link is ... [url]http://www.daniweb.com/forums/thread70096.html[/url]

Member Avatar for mitrmkar
0
117
Member Avatar for Sky Diploma

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]

Member Avatar for Sky Diploma
0
164
Member Avatar for shadow_shooter

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]

Member Avatar for Salem
0
2K
Member Avatar for flash121

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]

Member Avatar for flash121
0
142
Member Avatar for programmer321

[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. …

Member Avatar for programmer321
0
175
Member Avatar for JFBiomed

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.

Member Avatar for JFBiomed
0
244
Member Avatar for noraantonia

[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 …

Member Avatar for noraantonia
0
613
Member Avatar for DJ-KhaosTheory

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);

Member Avatar for DJ-KhaosTheory
0
4K
Member Avatar for Adrian99420

[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]

Member Avatar for mitrmkar
0
176
Member Avatar for nurulshidanoni

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]

Member Avatar for mitrmkar
0
611
Member Avatar for Jennifer84

Try taking a look at here [url]http://en.csharp-online.net/CheckedListBox[/url] to get an idea about what a multicolumn listbox is.

Member Avatar for Jennifer84
0
228
Member Avatar for programmer321

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.

Member Avatar for programmer321
0
2K
Member Avatar for TheOneNOnlyQ

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 …

Member Avatar for Ancient Dragon
0
760
Member Avatar for amroto

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.

Member Avatar for amroto
0
482
Member Avatar for tgiboss1

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]

Member Avatar for tgiboss1
0
805
Member Avatar for noraantonia

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.

Member Avatar for noraantonia
0
128
Member Avatar for Jennifer84

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]

Member Avatar for Jennifer84
0
148
Member Avatar for knight fyre

About fflush(stdin); see [url]http://www.gidnetwork.com/b-57.html[/url]

Member Avatar for jephthah
0
128
Member Avatar for Jennifer84

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.

Member Avatar for Jennifer84
0
127
Member Avatar for 666kennedy

For a single error (ERRORC) it goes like this ... [code]do { // do something ... } while(-0.1 > ERRORC || 0.1 < ERRORC);[/code]

Member Avatar for mitrmkar
0
57
Member Avatar for William Hemsworth

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]

Member Avatar for William Hemsworth
0
200

The End.