1,118 Posted Topics

Member Avatar for raj1

There's no way in a for loop, since the (first,last) is a special case. Also, watch your index bounds and maintain your result's aggregate value: [code=C++] double ClosedPolyPerimeter( double x[], double y[], int N ) { int i; double result = sqrt( sqr( x[N-1] -x[0] ) +sqr( y[N-1] -y[0] ) …

Member Avatar for raj1
0
112
Member Avatar for Destini

Are you taking a course or just doing this on your own? You need to watch a few things. First, though, your strcopy should look like this: [code=MIPS] strcopy: lbu $t0,($a2) # load the char at $a2 sb $t0,($a3) # save the char at $a3 addi $a2,$a2,1 # next $a2 …

Member Avatar for Destini
0
1K
Member Avatar for guitarrick

A function is a function, whether it is a method or not. You must call it correctly, and in the right place: [code=C++] Odometer simulator; int number_of_miles_driven; cout << "Please enter the amount of miles driven : " << endl; cin >> number_of_miles_driven; simulator.input_miles(number_of_miles_driven); [/code] Notice how I changed the …

Member Avatar for Duoas
0
98
Member Avatar for adida948

Are you talking about [URL="http://en.wikipedia.org/wiki/Base64"]this kind of thing[/URL]? A number's representation is limited only by the number of digits used by the radix. We use [I]deci[/I]mal, meaning radix = 10: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. [I]Hexideci[/I]mal is radix 16: 0, 1, 2, 3, 4, 5, …

Member Avatar for Duoas
0
471
Member Avatar for ENG ISE student

Do try to compile your code before posting here. Once you fix it so that it compiles, post again. (an lvalue is the variable name to the [I]left[/I] of an equal sign).

Member Avatar for Duoas
0
93
Member Avatar for Tight_Coder_Ex

Just cast it the usual way: [code=C++] LRESULT CALLBACK MyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { if (uMsg == WM_GETMINMAXINFO) { cout << "Max Window Size is (" << ((LPMINMAXINFO)lParam)->x << ", " << ((LPMINMAXINFO)lParam)->y << ")" << endl; } return DefWindowProc( hWnd, uMsg, wParam, lParam …

Member Avatar for Duoas
0
123
Member Avatar for Ccrobinson001

OK, according to your problem description I have a few comments to help... But FIRST, please take the time to be careful about how you "format" your code. You've made some indentation errors (that is, because of the way you have indented your code you have made some errors!) [B][U]text …

Member Avatar for Ancient Dragon
0
228
Member Avatar for matticus1181

I know nothing about SunSparc assembly, but I think your problem is in mixing data types. When the user inputs a number, like 1230, that's four ASCII characters: 49, 50, 51, and 48. So, you need to decide what kind of numbers you intend to add: binary or ASCII? (I …

Member Avatar for Duoas
0
170
Member Avatar for wijitha

I don't know anything about the CppUnit framework, but you should be able to compile just like any other. A makefile has a pretty simple layout. I'll assume that you are compiling a program named "quux" from the source files "quux.cpp" and "baz.cpp" and linking the library "bar". A makefile …

Member Avatar for Duoas
0
451
Member Avatar for #include<DAN.h>

What do you mean by "output window"? If you mean some TTY (like the console) then the answer is: yes, it is possible. If you mean some other thing then the answer is: maybe. Either way, you're going to have to be dinking around with things in an OS-specific way. …

Member Avatar for #include<DAN.h>
0
78
Member Avatar for ferhatkuskaya

You don't have to be a professional. You only need to pay attention. So far you have not. When writing a post that contains code, place all your code in code blocks: [B][[I][/I]code=Pascal[I][/I]][/B] program fooey; begin writeln( 'fooey' ) end. [B][[I][/I]/code[I][/I]][/B] becomes: [code=Pascal] program fooey; begin writeln( 'fooey' ) end. …

Member Avatar for Duoas
0
103
Member Avatar for reza_jolie

[B][[I][/I]code=Pascal[I][/I]][/B] [code=Pascal] writeln( h:0:1 ); [/code] [B][[I][/I]/code[I][/I]][/B] This prints a real value (h) with an indefinite number of whole digits (0) and only one fractional digit (1). Hope this helps.

Member Avatar for Duoas
0
74
Member Avatar for therealsolitare

A 1D array is just a contiguous list of values. A 2D array is just a contiguous list of 1D arrays. I.e. [code] [0][1][2][3][4][5][6][7] :row 1 [8][9][A][B][C][D][E][F] :row 2 [0][1][2][3][4][5][6][7] :row 3 [0][1][2][3][4][5][6][7] :row 4 [0][1][2][3][4][5][6][7] :row 5 [0][1][2][3][4][5][6][7] :row 6 [0][1][2][3][4][5][6][7] :row 7 [/code] That's how we [I]think[/I] about …

Member Avatar for Duoas
0
3K
Member Avatar for dsuh06

int : integer (int *) : pointer to integer (int *)& : reference to pointer to integer So, somewhere you have a pointer to an integer. [inlinecode]int *p;[/inlinecode] Your function wants to play with it. [inlinecode]findMax( ..., p );[/inlinecode] Now [B]p[/B] points to the largest integer in your array of …

Member Avatar for dsuh06
0
72
Member Avatar for bob on whidbey

That's because you never actually uninstalled it. Press F1 and index "Installing Component Packages" to learn more. In a nutshell, there are two things you must watch for: the Delphi Library Path, and the available component list. Things on the component palette are chosen from the available component list, but …

Member Avatar for Duoas
0
76
Member Avatar for bob on whidbey

rc.exe is a program that comes with Visual Basic. If you are using Delphi/CodeGear you should look for brcc32.exe or something similar. If you are using Free Pascal or GNU Pascal, look for windres.exe. Hope this helps.

Member Avatar for bob on whidbey
0
311
Member Avatar for -EquinoX-

Don't do anything. Just go to the next character. Remember, all you have to do is find matching (). It would help you an awful lot if you get out a piece of graph paper and draw yourself one of these equations, then figure out how to find and handle …

Member Avatar for Duoas
0
81
Member Avatar for ferhatkuskaya

You have still failed to stick your code in [B][[I][/I]code[I][/I]][/B] blocks, so that it is not a nightmare to read. May I ask what exactly it is you are doing that requires so many components and timers all on one form? Your program is going to work like an elephant …

Member Avatar for Duoas
0
175
Member Avatar for ferhatkuskaya

Same kind of answer as in your other thread. For each tCheckBox, set the [B]tag[/B] property to 1, 2, 3, etc. as appropriate. Then give them all an onClick event method like this: [code=Delphi] procedure tAnaForm.CheckBoxClick( sender: tObject ); begin if tCheckBox( sender ).checked then begin tLabel( AnaForm.findComponent( 'DIKEYAC' +intToStr( …

Member Avatar for Duoas
0
84
Member Avatar for sathishkumar.e

At the risk of being repetitive for having mentioned this before, you may not have write access to your command line arguments. Moreover, you can't change their size. I think it is perfectly within reason to copy them into local character arrays: [code=C] int main( int argc, char *argv[] ) …

Member Avatar for Duoas
0
134
Member Avatar for Loyen

When you post code, stick it in code blocks: [B][[I][/I]code=Pascal[I][/I]][/B] program Hello; begin writeln( 'Hello, world!' ) end. [B][[I][/I]/code[I][/I]][/B] becomes: [code=Pascal] program Hello; begin writeln( 'Hello, world!' ) end. [/code] This is the easiest to read and use. Click the little [color=blue]Toggle Plain Text[/color] link at the top to get …

Member Avatar for Loyen
0
147
Member Avatar for CaitlynCraft

First, some thoughts: Your compiler lets you get away with it, but in C you should generally stick all variables before any code: [code=C] int i, n = 0, r; srand( time( NULL ) ); r = rand() %100 +1; [/code] Don't use (void) in front of printf(). (There's no …

Member Avatar for WaltP
1
1K
Member Avatar for e1fjl

That's actually correct. A [B]char *[/B] points to [B]chars[/B], not [B]int[/B]s or anything else. So saying: [inlinecode]int i = *s;[/inlinecode] causes the computer to go get the (eight-bit) char at *s, then assign the value to the int i. If you want to get bigger numbers, you'll need to read …

Member Avatar for e1fjl
0
105
Member Avatar for boosh

Sure, if you have enough room. For example, you can store two 8-bit values in a single 16-bit register. (By "string elements" do you mean "characters"?) A better question, though, is why do you want to do this? It doesn't sound safe.

Member Avatar for boosh
0
97
Member Avatar for vhinchies

No one is going to give you code. Look in your textbook and at your class notes. There is an x86 opcode that does addition.

Member Avatar for mytime19
0
406
Member Avatar for matt nagel

> I am not sure if this is needed or not, but most CSV files have a header record, which is essentially the names of the columns separated by commas. If you are parsing an actual CSV file, you will need to take that into account also. That may be …

Member Avatar for Duoas
0
7K
Member Avatar for ferhatkuskaya

Your reported errors don't have much to do with the code you are showing me (at least not as far as I can tell --please use [B][[I][/I]code[I][/I]][/B] blocks when posting). Are you using Delphi (a.k.a. CodeGear) or are you using FPC? If the former, then you should use the help …

Member Avatar for Duoas
0
162
Member Avatar for squidd

What you have written looks right. But just to make sure you got there correctly (which makes all the difference): 1. You added a button to your form and named it "ReverseOrderButton". 2. You either a) double-clicked the button on your form, or b) changed the object inspector to list …

Member Avatar for squidd
0
176
Member Avatar for asilter

You are using the wrong function family. [URL="http://mkssoftware.com/docs/man3/execl.3.asp"]exec()[/URL] isn't supposed to return. Use one of the [URL="http://en.wikipedia.org/wiki/Spawn_(computer)"]spawn()[/URL] functions instead. Hope this helps.

Member Avatar for Duoas
0
118
Member Avatar for edek

Yes, the regex is easy, but the code you use makes a difference. Just use [inlinecode](.*)have[/inlinecode]. That will match everything up-to and including the "have". The first "capture", or subexpression, is everything except the "have".

Member Avatar for edek
0
90
Member Avatar for ferhatkuskaya

Look in your documentation for TComponent.FindComponent. You can say something like: [code=Delphi] for i := 1 to 50 do tLabel(DisplayForm.findComponent('Label' +intToStr(i))).caption := tMemo(AnaForm.findComponent('Memo' +intToStr(i))).lines[0]; [/code] Untested!

Member Avatar for ferhatkuskaya
0
94
Member Avatar for DREAMER546

I think I see what you are trying to do. You have a list of students, where each student has a name and an ID. [code=C++] #include <iostream> #include <vector> using namespace std; // This is our student, who has a name and an ID struct student_t { string name; …

Member Avatar for DREAMER546
0
102
Member Avatar for nanaman

There are no [I]procedures[/I] in scheme, only [I]functions.[/I] Whenever you say [B]define[/B], you are naming an expression that evaluates to something. Hence, follow along: [inlinecode](a-card 13 'spades)[/inlinecode] becomes [inlinecode](make-card 13 'spades)[/inlinecode] becomes [inlinecode](list 13 'spades)[/inlinecode] becomes [inlinecode]'(13 'spades)[/inlinecode] The [B]make-card[/B] and [B]a-card[/B] functions do the same thing: take a rank …

Member Avatar for Duoas
0
117
Member Avatar for Duoas

I'm always dinking with my PATH variable at the command prompt. But the supplied windows "path" command is (and has always been) pathetic. Well, after my latest episode of typing "path" and getting 6!!! lines of clutter I had had enough. So I wrote this little utility that lets me …

Member Avatar for Duoas
0
283
Member Avatar for deitystrife

I haven't played with it really, but offer only this observation: using floats exactly is playing with fire. And you're stepping on the gas with [inlinecode]payment/.01[/inlinecode]. If you must use floats, just say [inlinecode]payment*100[/inlinecode]. There's a nifty routine called [B]modf()[/B] that splits a float into its integer and fractional parts. …

Member Avatar for Duoas
0
90
Member Avatar for drvd80

OK, here you go. (Don't use char arrays for strings.) [code=C++] #include <fstream> #include <iostream> #include <sstream> #include <string> using namespace std; string make_filename( int file_number ) { stringstream sfilename; sfilename << "Site_" << file_number << ".txt"; return sfilename.str(); } int main() { int Ns; string filename; for (Ns = …

Member Avatar for Duoas
0
2K
Member Avatar for Duki

Your errors are not invincible, but they are all due to a very bad mixture of I/O (sorry). You'll need to trace your program (using a piece of paper and pencil) to see what is happening. Firstly, don't use output methods ([B]cout[/B], etc.) inside an overloaded input operator (>>). That …

Member Avatar for jbennet
0
242
Member Avatar for ferhatkuskaya

A TButton was not designed as a container component, so the IDE won't let you put labels in buttons. Why not just change the button's caption? If you must, however, see [URL="http://www.daniweb.com/forums/thread93077.html"]this thread[/URL]. Hope this helps.

Member Avatar for Duoas
0
111
Member Avatar for johnpmii

That won't work. Be careful how you initialize the stream. If I understand correctly, there are [I]two[/I] delimiters you need to worry about: the end of line ('\n') and the colon (':'[I][/I]), where the former is primary. So... [code=C++] #include <fstream> #include <iostream> #include <sstream> #include <string> using namespace std; …

Member Avatar for Duoas
0
161
Member Avatar for nicz888

> how would i write a maximum number test function that will take any number of arguments and returns the greatest of them??? I think it would be very odd that your professor wants you to create a function that takes a variable number of arguments. Perhaps you should work …

Member Avatar for Duoas
0
143
Member Avatar for AlexN

Sounds like you are asked to do something repetitively, so that suggests using a loop. Post some code and we'll help further. (You should be able to do this on your own.)

Member Avatar for Duoas
0
134
Member Avatar for sanjay goyan

What shell are you using. If it is bash or csh or somesuch, you need to use backquotes: [inlinecode]echo `expr 2+4`[/inlinecode] Hope this helps.

Member Avatar for masijade
0
106
Member Avatar for eyehategod

You'll need to check your compiler's documentation. If you are using gcc, you can compile with the -S (that's a capital S) option to test some assembly code and look for yourself: [code=C] char foo( char c ) { return c +1; } int main() { return foo( 0 ); …

Member Avatar for eyehategod
0
85
Member Avatar for lkkkeith

You are going to have to play with the [B]crt[/B] unit. It has procedures and functions that will let you do things to the screen (clear it, move the cursor to a specific location, change colors, etc.) Good luck.

Member Avatar for Duoas
0
114
Member Avatar for phalaris_trip

You are both mixing between the pointer and the pointee. [inlinecode]CPoint foo;[/inlinecode] is an actual CPoint. It exists. [inlinecode]CPoint *foo;[/inlinecode] is a pointer to a CPoint. So far, no CPoint actually exists. [inlinecode]CPoint **foo;[/inlinecode] is a pointer to a pointer to a CPoint. So far, neither a "pointer to a …

Member Avatar for Duoas
0
109
Member Avatar for Jishnu

That program computes an approximation of PI by computing its own area. If you want to get more digits out of it, write a bigger program. [[URL="http://www.catb.org/~esr/jargon/html/O/Obfuscated-C-Contest.html"]1[/URL]] BTW. That one's been around for [I]years[/I]. It's one of the oldest entries in the [URL="http://www.ioccc.org/"]International Obfuscated C Code Contest[/URL].

Member Avatar for Jishnu
0
217
Member Avatar for freakybeavis

It shouldn't work on XP either. You've declared "numb" as a [I]pointer[/I] to characters, but there aren't actually any characters being pointed at. Question: why are you using a char* anyway? Use the STL string class: [code=C++] #include <iostream> #include <string> using namespace std; int main() { string s; int …

Member Avatar for freakybeavis
0
99
Member Avatar for mafarjeh

No. Do your own homework. If you want help along the way, post what it is that is giving you trouble and we'll help.

Member Avatar for ithelp
0
135
Member Avatar for mark0420

No one here is going to give you something they had to pay for. Besides which, it's illegal. There are plenty of free programming resources on the web you can use just as well as anyone else. [URL="http://www.dmoz.org/Computers/Programming/Languages/"]Here's a good place to start[/URL].

Member Avatar for Duoas
0
89
Member Avatar for mark0420

Please listen to [B]WaltP[/B] and google it. [URL="http://en.wikipedia.org/wiki/Scanf#Format_string_specifications"]Here's what Wikipedia says[/URL]. You can find printf the same way.

Member Avatar for mark0420
0
109

The End.