2,045 Posted Topics

Member Avatar for CreativeCoding

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 …

Member Avatar for jonsca
0
125
Member Avatar for CreativeCoding

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 …

Member Avatar for CreativeCoding
0
158
Member Avatar for anjoz

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 …

Member Avatar for anjoz
0
120
Member Avatar for pearle

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.

Member Avatar for WaltP
0
158
Member Avatar for winecoding

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.

Member Avatar for mrnutty
0
96
Member Avatar for lotrsimp12345

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.

Member Avatar for jonsca
0
87
Member Avatar for enderland

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

Member Avatar for jonsca
0
192
Member Avatar for conkjj8

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

Member Avatar for jonsca
3
310
Member Avatar for reza.adinata

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]

Member Avatar for reza.adinata
0
156
Member Avatar for ckjie

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?

Member Avatar for ckjie
0
151
Member Avatar for ctrl-alt-del

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 …

Member Avatar for jonsca
0
108
Member Avatar for BrandonB

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

Member Avatar for BrandonB
0
140
Member Avatar for miraclebos

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

Member Avatar for miraclebos
0
166
Member Avatar for Xufyan

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 …

Member Avatar for Xufyan
0
1K
Member Avatar for pearle

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

Member Avatar for pearle
0
117
Member Avatar for jemscomput
Re: c++

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.

Member Avatar for jwenting
0
111
Member Avatar for CreativeCoding

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.

Member Avatar for jonsca
0
115
Member Avatar for naveedmahar

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 …

Member Avatar for jonsca
0
230
Member Avatar for lethal.b

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?

Member Avatar for WaltP
0
250
Member Avatar for top123

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

Member Avatar for top123
0
120
Member Avatar for Encrypted
Member Avatar for MosaicFuneral
0
392
Member Avatar for skerdzius
Member Avatar for JHus00

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 …

Member Avatar for jonsca
0
132
Member Avatar for vmanes

[quote]Carl Volt, Frank Amp, James Watt, Bob Transformer [/quote] ...was priceless LOL

Member Avatar for vmanes
0
78
Member Avatar for CreativeCoding

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]

Member Avatar for CreativeCoding
0
164
Member Avatar for yapkm01

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 …

Member Avatar for vmanes
0
113
Member Avatar for ROTC89

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

Member Avatar for ROTC89
0
115
Member Avatar for GrimJack

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

Member Avatar for Biker920
1
165
Member Avatar for epicasian

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

Member Avatar for epicasian
0
327
Member Avatar for sblass92

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

Member Avatar for sblass92
0
113
Member Avatar for FlippA

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

Member Avatar for Geekitygeek
0
122
Member Avatar for PDB1982

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 …

Member Avatar for tetron
0
530
Member Avatar for DoEds

[icode]if ( x > 3 ) x = 0; [/icode] When will x ever actually reach 10?

Member Avatar for jonsca
0
114
Member Avatar for yasaswyg

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

Member Avatar for jonsca
0
96
Member Avatar for endframe

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

Member Avatar for BrianWren
0
234
Member Avatar for Duncans Ghola

a is a char and " " is considered a string. When comparing something with a char, use the ' ' (single quotes).

Member Avatar for Duncans Ghola
0
160
Member Avatar for Stefano Mtangoo

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.

Member Avatar for Stefano Mtangoo
0
66
Member Avatar for abarlowa
Member Avatar for NitaB

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

Member Avatar for NitaB
0
326
Member Avatar for DavidDD

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

Member Avatar for WaltP
0
114
Member Avatar for gaurav10

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 …

Member Avatar for gaurav10
0
124
Member Avatar for DoEds

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 …

Member Avatar for DoEds
1
276
Member Avatar for ravikiran32
Member Avatar for re41verse

[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

Member Avatar for Excizted
0
78
Member Avatar for sssouljah

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

Member Avatar for jonsca
0
139
Member Avatar for peter_budo

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 …

Member Avatar for lllllIllIlllI
0
124
Member Avatar for P_funk22

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 …

Member Avatar for jonsca
0
144
Member Avatar for nmcentire

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

Member Avatar for jonsca
0
137
Member Avatar for bigbiboun

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 …

Member Avatar for jonsca
0
339
Member Avatar for sid78669

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 …

Member Avatar for sid78669
0
139

The End.