2,045 Posted Topics

Member Avatar for MrMee

Use the "as" keyword to cast them (I ignored the list portion for simplicity): [code] BaseGameEntity bge = new Drop(); (bge as Drop).DropMethod(); [/code] or you can use the old fashioned [code] ((Drop) bge).DropMethod(); [/code]

Member Avatar for jonsca
0
86
Member Avatar for pixelerator

Assign it to a std::string or char array. Within your class you can design your own methods for doing operations with the numbers.

Member Avatar for pixelerator
0
200
Member Avatar for zaharaandfarah

The math.h functions take an angle in radians. Use the conversion pi radians is to 180 degrees to convert your angles before sending them in.

Member Avatar for n.utiu
0
84
Member Avatar for Nabeel24

Next time please use the code tags. Type: [noparse][code] //code goes here [/code][/noparse] Since you assign bonusContributed a value in an if/else structure, if your sales are less than 10,000 you won't assign it a value at all. Even if it is >=10000, your if/else if statements in the second …

Member Avatar for jonsca
0
238
Member Avatar for dragonflare

First, another issue at hand. [code] #include <iostream.h> #include <fstream.h> #include <stdlib.h> [/code] should be [code] #include <iostream> #include <fstream> #include <cstdlib> [/code] The ones with the .h are prestandard C++ headers (and when using stdlib.h from c, use the cstdlib version). There's a design problem brewing here. If you …

Member Avatar for NathanOliver
0
167
Member Avatar for blind122

[icode]if(values == 00) [/icode] This will not work as written. Values is an integer variable and I believe this will simply register as 0. You'll have to use another sentinel value or take in input as a string and convert it to int. Also, your function returns void so attempting …

Member Avatar for blind122
0
111
Member Avatar for munna_001

[quote]i want textbox to show all the values i.e. as the values are generated by generate_data class, the values should be passed to textbox in new line instead of overriding. [/quote] Or change line 26 to [icode] textBox1.Text +=value; [/icode]

Member Avatar for munna_001
0
273
Member Avatar for yasy
Member Avatar for Adak
0
111
Member Avatar for pinsickle

Make sure it's between 0 and 9 and then add '0' to it. [icode] char a; a= '0' + 1 [/icode] (a = '1')

Member Avatar for jonsca
0
269
Member Avatar for fugnut

You're doing a couple of things that are confusing to me. When you're getting a random word, you're reading your file back in again. You already have the words in the array, you should pick a random one out of there. You also don't use the return from randomword at …

Member Avatar for jonsca
0
190
Member Avatar for chipbu

What do you mean by fails to execute? What do you end up with in the string? Does it throw an exception? EDIT: I just tested it with 3 copies of a (short) novel in a row (~500K) and had no problem

Member Avatar for jonsca
0
186
Member Avatar for fyp

All you probably need is [icode]DateTime::Now.ToString() [/icode] to get the current time and date. I'm not sure why you would need the picker but if you want the user to specify the date you could get it by [icode] dateTimePicker1->Value.ToString() [/icode] EDIT: Was typing during FBody's post but what he …

Member Avatar for Ancient Dragon
-1
173
Member Avatar for rtllz

What have you tried? Hint: read a line into a string, output the string (not the only way of course).

Member Avatar for Ancient Dragon
0
1K
Member Avatar for nirveshverma

IMO, Head First C# is a good way to get from the ground to the first/second floor quickly. From there you could select something more suited to a specific area where you want to end up.

Member Avatar for apegram
1
135
Member Avatar for PSP1202

If you are initializing min to zero then it's always going to be lower than any (positive) number that you encounter in the list. Set minimum initially to the first element of the list (works when you're finding max too). EDIT: Beaten by vmanes. Curses, foiled again!

Member Avatar for PSP1202
0
116
Member Avatar for zandiago

Thankfully this issue hasn't lead to bonuses (or lack thereof) in my region. The scores of the standardized tests (similar to what Vernon was talking about) do count for the schools stature in the state and district so it can affect things like funding. The problem is that the "benchmarkers" …

Member Avatar for diafol
2
382
Member Avatar for Lukezzz

You have to include <windows.h> and change a couple of compiler settings to get it to work with the unmanaged code. See [url]http://social.msdn.microsoft.com/Forums/en-GB/vcgeneral/thread/4d24375c-15c5-4c31-ac39-304750a1e556[/url]

Member Avatar for Lukezzz
0
1K
Member Avatar for shrutinr

You're probably a lot more likely to get the help you need someplace like [url]http://forums.ni.com/ni/[/url] (not to say you can't post it here, but just a friendly suggestion)

Member Avatar for jonsca
0
193
Member Avatar for inisca

[QUOTE=chary8088;1187748]C# language ,,this is CPP forum[/QUOTE] Meet [URL="http://en.wikipedia.org/wiki/C%2B%2B/CLI"]C++/CLI[/URL]. We keep it out in the woodshed but it's a member of the family nonetheless. :)

Member Avatar for jonsca
0
134
Member Avatar for sjn21682

Add a constructor to your class: [code] class DataBase { OleDbConnection MyCon1; OleDbCommand MyCmd1; OleDbDataAdapter MyDataAdapter1; DataTable MyDataTable; System.Windows.Forms.TextBox textBox; public DataBase(System.Windows.Forms.TextBox textBox) { this.textBox = textBox; } //rest of your class } [/code] (obviously a using directive will eliminate the System.Windows.Forms, but it is not on there by default …

Member Avatar for jonsca
0
212
Member Avatar for sunnynight
Member Avatar for chipbu

Do you mean something like: [code] char a, b; //read in a and b and change to caps int[,] occurrences = new int[26, 26]; Console.WriteLine("The Co-occurrence of " + a + " and " + b + " is " + occurrences[a - 'A', b - 'A']); [/code]

Member Avatar for kplcjl
0
1K
Member Avatar for J.Killa

Yes, there is an overload which takes a char. A good reference:[url]http://www.cplusplus.com/reference/string/string/find/[/url] EDIT: AD's got it ^^^^^^^^^ (but that site is still a good reference)

Member Avatar for J.Killa
0
303
Member Avatar for rkp728
Member Avatar for Mena samy

[code] MPI_Send ((void *)&line, 1, MPI_CHAR, 1, 0xACE5, MPI_COMM_WORLD); [/code] I think (can't test it unfortunately) should be: [code] MPI_Send (line, strlen(line)+1, MPI_CHAR, 1, 0xACE5, MPI_COMM_WORLD); [/code] since line is a char array it is already a pointer.

Member Avatar for Mena samy
0
189
Member Avatar for J.Killa

Check the starting index on line 17, what's the last index of an array of length numchars? You're on the right track with the loop but run through it by hand, you're always replacing the last entry of backwards with the next. See what you can come up with.

Member Avatar for WaltP
0
226
Member Avatar for heynow12

[QUOTE=firstPerson;1186154]put the "cout << endl; " at the end of the first for loop. So do this : [code] for(i=1;i<5;i++) { for( j=1;j<6; j++) { infile>>random[i][j]; cout<<random[i][j]<<endl; } cout<<endl; } [/code][/QUOTE] Maybe you caught it already but line 6 of the snippet should probably be [icode] cout<<random[i][j]<<" "; [/icode] (no …

Member Avatar for jonsca
0
158
Member Avatar for stryker4526

I didn't go over your code in great detail. I was able to run it with the following output: [code] There is no element at the given ID. The ID of the station being added already exists. Name: Boardwalk, ID number: 1 Name: Boardwalk, ID number: 6 Name: New York …

Member Avatar for jonsca
0
125
Member Avatar for NitaB

If you have an 8 digit binary number, you want to have it so you're multiplying the value in position n with 2^(7-n). You could send in the size of the number in digits as a third parameter to your function that wouldn't change.

Member Avatar for jonsca
0
138
Member Avatar for xofth

Put in a [icode] cin.ignore()[/icode] after the [icode] ans = getche(); [/icode] line. The newline ('\n') from the when you entered y or n the first time was staying in the input stream and getting picked up by the getch() which took it as input and moved on. I don't …

Member Avatar for xofth
0
223
Member Avatar for Drunk.scientist

I wouldn't make lastLetter and nextToLast neither pointers nor arrays (there's not much point to having a 1 element array anyway). I would make them both chars and set lastLetter to verb[size-1] and the other to verb[size-2] (using the array notation for the string). Another problem you are going to …

Member Avatar for jonsca
0
208
Member Avatar for PDB1982

You still have the for loop within the while loop which I think someone had pointed out already. What happens when your file has 9 values in it? You don't need it anyway, just increment j within that while loop.

Member Avatar for PDB1982
0
83
Member Avatar for nats01282

Take it into a string and parse everything (either with your own function that multiplies out the place values or something like atoi) up to the slash as one integer and parse everything after as a second integer. Or a simple way to do it would be have the user …

Member Avatar for nats01282
0
171
Member Avatar for angel19

If you're skipping over the design phase completely you're doing yourself a disservice. All of the work with the use cases, CRC cards, etc. should be done before you write a single line of code, that way you can include the OO principles from the ground up.

Member Avatar for mn.balakumar
0
3K
Member Avatar for sdgz747

Disp and input should just take plain ol' strings. I'm not sure what you are trying to do with the [ ] but I don't believe it's correct. In the case on the last 2 lines you'll have to use something like sprintf to make a string out of the …

Member Avatar for jonsca
0
135
Member Avatar for Anarionist

[QUOTE=Anarionist;1174377]I'm trying my best to learn linked lists but am having a difficult time understanding them exactly any way debugger returns SIGSEGV [code] #include <iostream> using namespace std; typedef struct node *p; typedef struct data * d; struct node{ p next; d dat; }; struct data{ int id; }; int …

Member Avatar for Anarionist
0
88
Member Avatar for tonymuilenburg

SelectionStart is a property specific to TextBox. Text is a property that all Controls have. To access that property you need to downcast the controls to their particular type using a dynamic_cast to TextBox^ type. You'll have to do some checking to make sure that you have the right controls …

Member Avatar for tonymuilenburg
0
177
Member Avatar for bletchley

[QUOTE=bletchley;1182577]Got it to work by changing the include in main.cpp from "LList.h" to "LList.cpp" and only doing "g++ Main.cpp -o Main".[/QUOTE] In this situation you should have left it as [icode] #include "LList.h" [/icode] and compiled it as [icode] g++ LList.cpp Main.cpp -o Main [/icode] that way LList.cpp gets compiled …

Member Avatar for jonsca
0
127
Member Avatar for Takarakujin

The way you have it will only store 255 characters, not 255 strings. Make your array 2D. For example, [icode] char arr[255][10]; [/icode] would allow you to store 255 strings of 9 characters each (plus a '\0'). You could enter strings into them by using [icode] fgets(arr[i],sizeof(arr[i]),stdin); [/icode] where I …

Member Avatar for Software guy
0
81
Member Avatar for theABCasian

Lines 17 and 18 of password.h do not need the Password:: qualifier. Since they are being declared within the class it is assumed just like it is for the constructor/destructor.

Member Avatar for mitrmkar
0
172
Member Avatar for apo

I'm still confused. Is this for a WinForms application? I'm not sure what label you are talking about that has a caption (and I'm only guessing about what you mean by standard bar). This will work for a generic label: [code] double pi = 3.141592654; label1->Text = String::Format("{0:F4}",pi); [/code]

Member Avatar for jonsca
0
130
Member Avatar for gregarion

Are you allowed to use std::vector or are you limited to arrays? A vector would let you expand your set as needed. See [url]http://www.cprogramming.com/tutorial/stl/vector.html[/url] for a quick introduction.

Member Avatar for jonsca
0
91
Member Avatar for JohnPhilipps

[QUOTE=daviddoria;1179110]Is this c++? I don't think [icode]ref class CSquare: Rectangle[/icode] or [icode]property int lt [/icode] are valid c++ statements. Dave[/QUOTE] It's [URL="http://en.wikipedia.org/wiki/C%2B%2B/CLI"]C++/CLI[/URL]. If one needs .NET winforms in a C++ application it's basically the only avenue.

Member Avatar for jonsca
0
1K
Member Avatar for theABCasian

There are many ways you can make your life easier on this one. I'll focus mostly on 62-77. You should make your array only 26 members long. That way there is not a lot of wasted array space to confuse the matter. There's an easy mapping between chars and an …

Member Avatar for jonsca
0
67
Member Avatar for bandit711

Code tags: it's simple. Type: [noparse][code] //paste your code in here Type: [/code][/noparse] (or highlight your entire code and click on the [noparse][code][/noparse] button on the editor toolbar. Now, there's a simple error hampering your progress here: [code] void open_input(ifstream& input, char name[])[COLOR="Red"][B];[/B][/COLOR] [/code] (that would have been on line …

Member Avatar for bandit711
0
139
Member Avatar for pistol-pete

Characters are essentially nothing more than 1-byte integers. So if your letter that you were counting were 'a' what operation could you do to yield the index 0? How about for 'b' to yield 1? You'll kick yourself once you get it. So the array will hold integers and be …

Member Avatar for jonsca
0
195
Member Avatar for some

[code] if (pch1 != NULL) { cout << "My name, you say\n" << "It is Jubajee\n" << "Cool eh?\n"; redo = 1; } [/code] Are you talking about the above printing out [code] My name, you say It is Jubajee Cool eh? [/code] all at once? I'm unclear on what …

Member Avatar for some
0
138
Member Avatar for bandit711

There were a lot more errors than 2. In your output function you are missing some pairs of parentheses. As Excizted mentioned please learn to use code tags. Type in [noparse][code] //code goes here [/code][/noparse] It makes it very difficult to see what's going on with your code when the …

Member Avatar for bandit711
0
293
Member Avatar for deeer
Member Avatar for deeer
0
758
Member Avatar for bill_

Can you show an example data file? I think if you know all the dimensions ahead of time you could just use a for loop to read in the data and make things slightly easier on yourself.

Member Avatar for bill_
0
459

The End.