1,118 Posted Topics

Member Avatar for helixkod

You can't say: [code] int a[100], b[100]; a = b; [/code] That doesn't make sense. You can't change the value of [B]a[/B]. What would make sense is what you said: "i want the character array to be swapped with it." In other words, you want to exchange the [I]values[/I] in …

Member Avatar for Duoas
0
92
Member Avatar for helixkod

> I was told to use pointers whenever possible In C++ you should avoid both. > i just don't know if a char pointer is possible. Did you try compiling your code above? Did it complain about a [inlinecode]char *[/inlinecode] ? You can make a pointer to [I]anything[/I]. You'd be …

Member Avatar for Duoas
0
113
Member Avatar for jrice528

Between lines 51 and 52 you need to add [inlinecode]return EXIT_SUCCESS;[/inlinecode]. (If you start your code blocks with the name of the language you are using, you get line numbers: [[I][/I]code=C++[I][/I]].) Line 56: are you sure there is an argv[ 1 ]? Line 57: are you sure there is an …

Member Avatar for Duoas
0
115
Member Avatar for boyz

As long as you keep the sequence points intact and the two values are the same ordinal type then you can do it just fine: [inlinecode]a ^= b, b ^= a, a ^= b;[/inlinecode] Remember though, the result of this expression is the final value of [B]a[/B].

Member Avatar for Duoas
-1
127
Member Avatar for vegaseat

Heh, y'all missed my favorite really stupid language: Whitespace. [code]Say hello. [/code] Source: [URL="http://compsoc.dur.ac.uk/whitespace/examples.php"]whitespace examples[/URL]. BTW. That "Say Hello." thing at the top is just a comment...

Member Avatar for sgssergio
0
1K
Member Avatar for jaden403

I don't know Lisp, but I do know Scheme. Write yourself a little recursive function that does the job. I would use an index into the string to keep the original string reference (instead of recursively operating on copies of substrings). When you run out of string, then you've found …

Member Avatar for Duoas
0
97
Member Avatar for teddyzhai

I don't know where you got that code, but it is wholly ineffective. It uses the copy constructor whether you like it or not. Further, you left the return type off of the copy() function (so it wouldn't compile). If you declare it as: [inlinecode]A &copy();[/inlinecode] then you'll wind-up with …

Member Avatar for Duoas
0
144
Member Avatar for pocku

You should be making better use of functions. For example, [B]convert[/B] would be better written as: [code=Pascal] function convert( c: char ): integer; begin convert := ord( c ) - ord( '0' ) end; [/code] And then used thus: [inlinecode]digit1 := convert( c );[/inlinecode] Also, you don't need to specify …

Member Avatar for Duoas
0
123
Member Avatar for forandom.pan

I usually find that there is a good reason, but in this case I can't see any reason to have those temporary variables, as they are unused in any other way. Perhaps they are just a relic when the original author was debugging the routine... Also, this routine is amazingly …

Member Avatar for Duoas
0
128
Member Avatar for valdix

Do you mean [URL="http://en.wikipedia.org/wiki/Coprime"]coprimes[/URL]? Also, [URL="http://www.daniweb.com/forums/announcement8-2.html"]see this forum announcement[/URL].

Member Avatar for Salem
0
157
Member Avatar for wambooman

What you need to do is find a useful reference. I like [URL="http://www.cppreference.com/"]cppreference.com[/URL], but it is rather curt. In C++, you can easily append strings and characters, so you might try something like: [code=C++] #include <iostream> #include <string> using namespace std; string spacesToTilde10( string s ) { string result; for …

Member Avatar for Duoas
0
125
Member Avatar for AlexN

I almost missed this because your thread is marked 'solved'. That last thing is so full of errors I don't think you've spent much time reading over your textbook or class notes. It certainly won't compile, and most pascal compilers are pretty explicit about where and what errors you have, …

Member Avatar for Duoas
0
121
Member Avatar for Ries

Google "delphi sockets" for help. You'll have to implement a few server/client programs (the same program can be both) that allows you to communicate. There is no limit to [I]what[/I] you send over a connection (it looks much like a file stream when you use it). The trick is just …

Member Avatar for Duoas
0
85
Member Avatar for s69265

[URL="http://www.catb.org/retro/"]http://www.catb.org/retro/[/URL] "Other" languages are those without a specific forum here at DaniWeb. For example, Perl has its forum, but [URL="http://en.wikipedia.org/wiki/Scheme_%28programming_language%29"]Scheme[/URL] does not. Scheme stuff goes here. Likewise, something like [URL="http://en.wikipedia.org/wiki/Tcl"]Tcl[/URL] would go here. Both these are powerful languages in their own right, and used often enough today. (They aren't dead …

Member Avatar for Duoas
0
108
Member Avatar for tiki_master

Watch your condition flags. ADD modifies the flags register just as much as CMP does. So you only loop above if SI is not zero... Also, the last two lines never get called... Hope this helps.

Member Avatar for Duoas
0
269
Member Avatar for coolerfantasy

Macros aren't functions. When you use a macro the text of the macro is inserted verbatim into your code. Hence: [code=asm] print macro str .data x db str .code mov ax, seg x ... [/code] Gets used: [code=asm] print "Hello" print "world" [/code] and becomes: [code=asm] .data x db "Hello" …

Member Avatar for Duoas
0
115
Member Avatar for robyngar

Er, this is the wrong place for such questions. This forum is for people progamming in C++. A CD usually needs to have some formatting done to it before writing. Perhaps your software is complaining that it hasn't been prepared to write audio data to it?

Member Avatar for vigneshvh
0
201
Member Avatar for joshua.tilson

If you wish this to be "portable" across at least Windows and Unix, you should make use of the curses library. You can get PDCurses which works on both systems, and a few others to boot. Most *nix systems come with ncurses (or at least curses) already installed and usable. …

Member Avatar for Duoas
0
344
Member Avatar for Gia

There are syntax and type errors throughout (maybe only a little dyslexia, perhaps?). For example: [inlinecode]printf("n\Thank you. You entered %s\n" PurchaseAmount);[/inlinecode] should read: [inlinecode]printf("\nThank you. You entered %d\n", PurchaseAmount);[/inlinecode] The main problem, though, is how you are handling types. Ah, I just previewed and I see [B]Salem[/B] has noted the …

Member Avatar for bitRAKE
0
101
Member Avatar for toolmanx

Just caught this... Your documentation must be damaged. There is no error in what I have. Where did you get your HLP files? Like I said, mine are a bit old, but I can send it to you if you like.

Member Avatar for toolmanx
0
135
Member Avatar for chetah

Consult [URL="http://en.wikipedia.org/wiki/Booth%27s_algorithm"]WikiPedia[/URL]. It shows Booth's Algorithm in minute detail, and gives an example. Your code should have several subroutines: - one to display a binary number - one to do Booth's algorithm and return the product To display a binary number, just peel bits off of one end and put …

Member Avatar for Duoas
0
2K
Member Avatar for sura91

Any time you find that you are repeating yourself, that is a good thing to turn into a loop. First, figure out what changes each time and what stays the same. The thing that changes is a variable. In your examples (done with [[I][/I]inlinecode[I][/I]] so that I can highlight something) …

Member Avatar for Duoas
0
161
Member Avatar for aaabhish

Listen to [B]Salem[/B]. C does not have a [I]vector[/I] anything. Nor does it have [I]generic[/I] anything. Those are both C++ constructs.

Member Avatar for Ancient Dragon
0
113
Member Avatar for bitRAKE

> OK, so would eax, ax and al all be the same register/memory. Yes and no. Read on. > Can all three of those contain seperate values? Yes and no. Read on. AL is the [B]l[/B]ow-order byte of AX. AH is the [B]h[/B]igh-order byte of AX. Thus, AX is a …

Member Avatar for bitRAKE
1
8K
Member Avatar for AlanUK

C library functions (like [B]printf[/B]) are typically prefixed with an underscore. In in the object library it is actually named [B]_printf[/B]. If you plan to use them you must also link the library itself. How to do this varies between assemblers / linkers.

Member Avatar for Duoas
0
109
Member Avatar for towhoe260

You have syntax problems. line #16: get rid of the word "double" --you are not declaring a new variable (you've already declared "yards" above). line #21: same kind of problem. Replace the word "double" with "meters". Move your yards() function (lines 5..28) above main() (to line 8). Rename the yards() …

Member Avatar for WaltP
0
202
Member Avatar for JeffCarnell

I've never programmed one myself, but your son could go through the [URL="http://en.wikibooks.org/wiki/TI-Basic"]TI-BASIC WikiBook[/URL]. It has examples and explanations galore, all in tutorial format. Good luck.

Member Avatar for Duoas
0
89
Member Avatar for squidd

The TListView is going to be really slow no matter what. However, there are a couple of things you can do to help. In your loop on line 9, you are starting at zero again. You don't need to check things already known not to be duplicates. Say instead: [inlinecode]for …

Member Avatar for squidd
0
806
Member Avatar for sunrise2007

You have two problems: 1. Add a break statement after you set i to zero: [code=C++] void validate_name(string &name)//validate_name for each student { int i; for(i=0;i<(name.length());i++) { while( !(isalpha(name[i])) && !(isspace(name[i])) ) { cout<<"Enter correct Name of student ,please:\n"; getline(cin,name); i=0; break; } } } [/code] 2. You need to …

Member Avatar for sunrise2007
0
89
Member Avatar for jbstin

Have you looked at [URL="http://en.wikipedia.org/wiki/Assembly_language"]WikiPedia[/URL]? The next step is to get an assembler and start playing with it.

Member Avatar for Salem
0
82
Member Avatar for mactas

Pascal is pretty smart about typecasting between real and integer. [code=Pascal] var i: integer; r: real; begin write( 'Enter an integer> ' ); readln( i ); write( 'Enter a float> ' ); readln( r ); writeln( 'You entered ', i, ' and ', r:5:2, '.' ); writeln( 'The sum is …

Member Avatar for Duoas
0
84
Member Avatar for kebede
Re: hi

>i mean is assembly have it own compiler . Essentially, yes. An [B][I]assembler[/I][/B] turns assembly code into machine code. >how can write assembly code . What system are you using? There are many different assemblers...

Member Avatar for Duoas
0
78
Member Avatar for danbellinger1
Member Avatar for spockenheit

The [B]system()[/B] call forks out to another process. So if you use it to change the directory, it affects the new process, not your program.

Member Avatar for Duoas
0
90
Member Avatar for Barefootsanders

You are on the right track. The only problem is that [B]char[/B] is a single character, not a whole list of them (or array of them). You probably want to use a pointer to an array of chars. Also, don't use %s in scanf() without qualifying it with a maximum …

Member Avatar for Salem
0
210
Member Avatar for joygqy

[B]ExplainThat[/B], this is a beginning programming school assignment. I really doubt the professor expects a recursive descent algorithm. Nor do I think he is permitted to redefine the shape of his input. All the professor wants is some basic string parsing. [B]joygqy[/B] Show us some code, and we'll help you.

Member Avatar for ExplainThat
0
97
Member Avatar for nabilchampion

Windows was designed as a 'do everything' GUI, so you automatically get things like GetFontMetrics(). X11 is an entirely different beast. I don't know of any standard libraries for stuff you want. If you are willing to use QT then I highly recommend it. It is a powerful system for …

Member Avatar for nabilchampion
0
1K
Member Avatar for toolmanx

Please, please, use [B][[I][/I]code[I][/I]][/B] blocks to post. Anything else leaves unreadable and difficult to cut/paste stuff. Also, this is the C++ forum, not C. You misunderstand a few basic concepts. [color=green][B]1[/B][/color] Anything with [B]const[/B] in front of it cannot be modified. You don't need it here, especially since you intend …

Member Avatar for Duoas
0
2K
Member Avatar for sherwood12

That code won't help you with [URL="http://ptri1.tripod.com/"]Pascal's Triangle[/URL]. The computer is too stupid to help you do something. First figure out how to do it yourself, preferably with pencil and paper. Once you can do that, telling the computer how to do it is relatively easy.

Member Avatar for sherwood12
0
357
Member Avatar for g_loughnan

You can get rid of the line [inlinecode]Track(void);[/inlinecode] Move the following three lines: [inlinecode]string title;[/inlinecode] [inlinecode]string artist;[/inlinecode] [inlinecode]float duration;[/inlinecode] to between the two lines: [inlinecode]class Track {[/inlinecode] and [inlinecode]public:[/inlinecode] Since duration is in seconds, it should probably be [B]int[/B], not [B]float[/B]. Make your [B]time[/B] function match its prototype: [inlinecode]void Track::time()[/inlinecode] …

Member Avatar for g_loughnan
0
95
Member Avatar for balla4eva33

What he is saying is that he wants you to read the file all at once instead of line by line or int by int or whatever. To do that, you have to know how big the file is in bytes in order to allocate the memory to store it …

Member Avatar for balla4eva33
0
168
Member Avatar for captinmak

Always fix errors in the order they come. Line 81 is incorrect, so no variable named [B]recta[/B] is ever created, so when the compiler hits line 86 it complains about some structure variable you are using that doesn't exist. Try this instead: [inlinecode]Rect recta( 12.9, 13.4, 7.6 );[/inlinecode] Also, please …

Member Avatar for Duoas
0
120
Member Avatar for swuwarrior

Your code and your input file don't match. I cannot tell which things you are trying to put where. Please try to explain what goes where and I will try to help.

Member Avatar for WaltP
0
142
Member Avatar for maxmaxwell

How did you know 2 was the mode of (1,2,2,3,4)? Figure out how you knew that then you can tell the computer how to know it. Does that make sense? I find that a piece of paper and a pencil help a lot. There are several ways I can think …

Member Avatar for maxmaxwell
0
136
Member Avatar for RohitSahni

Don't say [inlinecode]int main( void )[/inlinecode] either. The [B]main()[/B] function actually does take arguments... but if you don't want to deal with them use C++, not some bad C abomination: [inlinecode]int main()[/inlinecode] When in Rome, do as the romans. When using C++, use C++ I/O. Don't use getchar() (or any …

Member Avatar for RohitSahni
0
555
Member Avatar for balla4eva33

I haven't looked over [I]all[/I] your code, but the [B]addAnimalToZoo()[/B] function looks fine to me. Polymorphism just means that you can derive from more than one class at a time. So, for example, you could make a SnakeHorse.

Member Avatar for balla4eva33
0
177
Member Avatar for picass0
Member Avatar for picass0
0
96
Member Avatar for gauravmishra

Have you looked at [URL="http://en.wikipedia.org/wiki/AVL_tree"]Wikipedia[/URL]? You really haven't given us much information to work with. "An array representation" can mean many, many different things. Post us the code you have so far and we'll help you fix it. Hope this helps.

Member Avatar for Duoas
0
92
Member Avatar for Scotty Turbo

I haven't examined you algorithm very deeply, but somewhere in [B]changeBoard()[/B] you are accessing an element outside of the [B]board[/B] array. The error is recorded on the stack (the board is also stored on the stack), but only noticed when you try to return from [B]main()[/B].

Member Avatar for vijayan121
0
203
Member Avatar for phasiro

You can split the string into tokens using the [B]stringstream[/B] class: [code=C++] #include <iostream> #include <sstream> #include <string> #include <vector> using namespace std; int main() { string s; stringstream ss; vector<string> v; cout << "Please enter a string to be separated by tab characters:" << endl; getline( cin, s ); …

Member Avatar for phasiro
0
126

The End.