2,045 Posted Topics
Re: If you're using it just within your Form class declare it as a public private or protected member of that class. Start from [icode]public ref class Form1 : public System::Windows::Forms::Form [/icode] and scroll down you'll hit an area where your buttons, webbrowsers, etc. are declared. Put it somewhere in there … | |
Re: I think what's happening (based on some experimenting) is that the code is progressing much faster than the website is loading. Therefore there is no url in place(it's undefined since the site hasn't loaded) by the time execution gets to your if statement. Check out the DocumentCompleted Event of the … | |
Re: Do you know how to draw random numbers with rand()? You need a "setup" function where you draw numbers between 0 and 15 and place them into an array 16 elements long checking to make sure the number you drew wasn't in the list already. Where are you having problems … | |
Re: You need to place a [icode] return; [/icode] (with no value) statement somewhere in your recursive function otherwise it will keep going on and on. Think about what your variable "value" will be when you run out of digits and use that as your base case. | |
Re: I believe it's a shortcut way of saying [icode] str[i] !='\0' [/icode] since once the pointer hits the end of the string it will be null and therefore that statement *(str+i) will be false. | |
Re: Put in a cin.ignore() after line 16 and before line 21. Your excess '\n' from when you enter the integer remains in the stream and gets caught by the getline. getline figures it has a line and stops reading. | |
Re: [QUOTE=enderland;1164700]So does getline only work with the following: [CODE]getline(cin, StrVariable); [/CODE] It threw errors when I first put it but seemed to work when I switched it to a string (instead of char).[/QUOTE] There are two different versions. This one works with C-strings (char *) and is a method of … | |
Re: [QUOTE=lotrsimp12345;1163970]pass pointers to functions instead of arrays. [/QUOTE] Passing int list[] is the same thing as passing int *list. The array "degrades" to a pointer when it's passed in. | |
Re: In order to place the string into the array of strings you must specify an index. E.g., [code] cin >> stName[0]; //to write into the first string in the array cout<<stName[0]<<endl; [/code] | |
Re: When the user clicks the button do you want a Save dialog box to pop up so they can name the file or what do you want to happen? | |
Re: Check out[URL="http://cboard.cprogramming.com/csharp-programming/105103-how-detect-capslock-csharp.html"] this thread[/URL]. It's got how to turn it off and on too (beyond what you need I know) but the detection of it is simple. I don't know anything about writing services but if you were to make a regular form and run it on a timer (so … | |
Re: If your paintLitres has a decimal of less than 0.5 it's going to round "down" (really just truncate off the decimal). Try using the ceil() function ([iCODE]#include <cmath>[/iCODE]). | |
Re: [quote]Hey Narue![/quote] Why can't I have groupies? I'm sure she'll be thrilled with the shout-out. Anyway... look at line 36 in relation to your while loop. Walk yourself through a cycle or two of the loop, noting when the file gets closed. | |
Re: When you don't use braces to delineate your if/else groupings only the statement immediately after the if or else gets executed: [code] if(condition) This would get executed when condition was true A statement here would cause an error when an else is present else This would get executed if condition … | |
Re: [code]else return (n / (2 * n + 1)) + seriesFunc(n-1);[/code] The first portion is being computed with integers, so you need to cast either the numerator or the denominator (or both) to a double. | |
Re: Your compiler is too outdated for your OS. It's 20 years old. Get mingw with the [URL="http://www.codeblocks.org/"]Code::Blocks IDE[/URL] or [URL="http://www.microsoft.com/express/Downloads/#2008-Visual-CPP"]Visual C++ Express Edition.[/URL](2010 version is coming out soon). EDIT: AD beat me. | |
Re: See this post from over in C# land: [url]http://www.daniweb.com/forums/post1129114.html#post1129114[/url] . You'll have to translate the syntax of it to C++/CLI (M$ mungware per Salem :) ) but it'll be the same .NET functions from the System.Net namespace (HttpWebRequest/ HttpWebResponse). It was a similar problem to what you are working on. | |
Re: firstPerson's definition is more like one that might be used in a formal mathematical setting. Check out the second paragraph of [url]http://en.wikipedia.org/wiki/Functional_programming[/url] for a comparison of the two definitions. I'm sure we could argue about the semantics of what constitutes a function (like "is a void function really a function … | |
Re: Why not read the line in as a std::string using getline() (which will stop at the newline) and do the processing of the characters afterwards? | |
Re: [icode]int nums[14],checknum[14],displaynum[14] [/icode] is how you've declared your arrays, with 14 total elements. Your loop goes 0,1,2,...,14 which is 15 elements. | |
Re: Are you compiling on *nix? If so you may need the -lm switch to get math.h properly. | |
| |
Re: Beware of this in your function: [code] double average(int sum, int numElms) { //int i; double avg; avg = [COLOR="Red"]sum/numElms[/COLOR]; return avg; } [/code] Since the two operands are integers the result placed into avg will be an integer result (so truncated or 0 if the denominator is bigger) despite … | |
Re: [quote]Carl Volt, Frank Amp, James Watt, Bob Transformer [/quote] ...was priceless LOL | |
Re: He didn't specify, but from another post I believe he is doing a CLR winforms and not an MFC application. It would be: [code] comboBox1->SelectedItem //The selected item (of type "object") //must be casted before using comboBox1->SelectedIndex //The (0 based) index of the item [/code] | |
Re: What's actually happening is something a bit different [code] cin >> ch1; cin >> int1; [/code] ch1 is a char so it holds 1 character. When you are typing in the character to go into this variable, you hit enter. Enter is a character which remains in the input stream … | |
Re: [quote]i want to be able to call a function from there to the array of individuals..how would i do that?[/quote] I'm not quite sure what you mean by that. Can you give a brief example? (just conceptually) | |
Re: ...my 0.02 and a borrowed dime. [B]>can an electromagnetic field affect a neuron?[/B] Yes. Google "transcranial magnetic stimulation" [B]>does an activated neuron generate an electromagnetic field[/B] Yes. [B]>if so, is that field strong enough to affect neighboring neurons[/B] Yes, but the affect is largely unknown and a subject of current … | |
Re: [icode]else if (randomNumber >= 31 && <= 59) [/icode] is not valid syntax it must be [icode]else if (randomNumber >= 31 && randomNumber<= 59)[/icode]. The same thing for line 34. As an aside, you only need to call srand one time in your program. | |
Re: I don't believe that you can call VectA.reserve() out in the middle of nowhere like that. I'm assuming this is a paraphrase of your code. Moving the reserve call to main() (after creating a main) I was able to get it to compile and give a size of 0. Edit: … | |
Re: I used something like this to get the index of the split: [code] Random rand = new Random(); int [] a = {1,4,5,3,1,4,6,7,8,1}; int [] spl = new int[4]; spl[0] = rand.Next(1, a.Length - 2); spl[1] = rand.Next(1, a.Length - spl[0] - 1); spl[2] = rand.Next(1, a.Length - spl[0] - … | |
Re: I believe the objective of the assignment is to have one instance of the rational class which contains both the numerator and denominator for the first number and another instance that contains both numerator and denominator for the second number. As other posters have pointed out, your setter functions are … | |
Re: [icode]if ( x > 3 ) x = 0; [/icode] When will x ever actually reach 10? | |
Re: [icode] scanf("%d",&a); [/icode] is reading the numbers into the same spot in the array "a" over and over again. Hence all the other spots are stuck with their uninitialized "values." You can fix it by using the index x as [icode]scanf("%d",&a[x]);[/icode] but see [url]http://www.daniweb.com/tutorials/tutorial45806.html[/url] for some safer alternatives to scanf. … | |
Re: Get rid of the z= on line 9, and pass in the address of z as the third parameter (just like you did with x and y). Now, in your function you must actually do the calculation with *c (as changing a and b will do nothing to c). | |
Re: a is a char and " " is considered a string. When comparing something with a char, use the ' ' (single quotes). | |
Re: Here's a fairly lucid explanation for [URL="http://stackoverflow.com/questions/103512/in-c-why-use-static-castintx-instead-of-intx/103526"]static vs dynamic.[/URL]. This has good examples. [URL="http://www.acm.org/crossroads/xrds3-1/ovp3-1.html"]Another article[/URL] that covers all 4 in an understandable way. How come you gave a link for google? LOL I'd been searching all over for it. | |
Re: [icode]while (newIsTherePtr->item!=item) [/icode] needs another condition to ensure you don't run right off the end of the list (e.g., && it with [icode]newIsTherePtr->next !=NULL [/icode] or however you designate the end of your list) | |
Re: You could do it with an enumeration type but the easiest way to go about it would be to store it as an integer (as you have) and only convert it to jack, queen, king, ace when it's displayed. [code] if(card == 11) std::cout<<"Jack of "<<house<<std::endl; else if (card == … | |
Re: Why not make life easier on yourself you're shifting between strings and char * unnecessarily. Change temp to a std::string and change line 9 to [icode] while (in >>temp) [/icode] (letting that drive the loop) and you can eliminate lines 11-21 and 23-24. Also on line 28 you don't need … | |
Re: You use it in a similar way to gets except you specify the maximum size of the char array you are reading into. Take line 33: [code] fgets(Stud[i].Name,sizeof(Stud[i].Name),stdin); (or you could put in 20 for the sizeof(Stud[i].Name) portion) (last parameter is there in case you wanted to get input from … | |
Re: What is the problem that you are having with it? | |
Re: [icode]for(int i = 0; i < array_size-1; i++) [/icode] You lose the last element this way. Should be i<array_size, so if you have an array of size 3 you get 0,1,2 | |
Re: [quote] .i get the error that [COLOR="Red"]f[/COLOR]ield.h does not exist..[/quote] It's reflected properly in the code that you've put up but if that's your exact error message than you've used the wrong case (f versus F) in one of your cpp files. One of the main problems you'll face after … | |
Re: You're not alone Peter. At last count I think we had: Nick Evan Myself sknake Agni BestJewSinceJC experiencing some variant of what you've described over the last 3-4 months. It is known to Dani. Crunchie may be right as the deleted posts factor has been Dani's opinion as well. I … | |
Re: To write the operations to a file, open up a filestream object, fout, and I would simply direct your operations into it as you go. When the user hits plus, [icode] fout <<" + "; [/icode] Unless you wanted to wait until the end of the line to make sure … | |
Re: [quote]Can I only use the curses library in a Unix environment? Or can I set it up so I can use this as is? [/quote] If you are using it in Windows, you need something like [URL="http://sourceforge.net/projects/pdcurses/files/"]pdcurses[/URL]. They have the dlls available zipped but you can also build it into … | |
Re: If I remember correctly, what you are referring to as outputs are actually the targets. The outputs are what your training set actually yields when run through the network. An example (largely artificial) say you have a network that will add, so your inputs would look like: [code] [1 1 … | |
Re: Use your getline statement to drive a while loop (I'm assuming you don't want the blanks you were just finding a way around them) [code] while(std::getline(cin,command,'\n')) { //Other statements here } [/code] When there's no more input the loop should exit. Make sure that in your file you don't have … |
The End.