1,118 Posted Topics

Member Avatar for rpjanaka

If you are using the GNU tools, you can say: [inlinecode]gmake -n -p[/inlinecode] to print the internal database used to compile without actually compiling anything. Also, you can get the GNU compiler to give you dependency information about a specific file: [inlinecode]gcc -MM foo.c[/inlinecode] prints all the non-system files that …

Member Avatar for Duoas
0
84
Member Avatar for SurviBee

Your limit is an [B]int[/B], which is too small to hold the number you have put in it. (Your compiler should have complained about this.) Try using a [B]long long[/B] or somesuch. Start [B]runningcount[/B] at 2, not one. Your [B]primeChecker()[/B] function is fine, but it will be slow. Hope this …

Member Avatar for Duoas
0
77
Member Avatar for go939

Google is your friend. Try [URL="http://linux.about.com/library/cmd/blcmdl3_dlsym.htm"]this[/URL]. Good luck.

Member Avatar for Duoas
0
138
Member Avatar for yomex4life

No one. Please use google. Sorry to be rude, but the only reason to code this in assembly is for homework. The game is not that hard so you can do it yourself easily.

Member Avatar for Duoas
0
56
Member Avatar for balla4eva33

The [B]int()[/B] operator should return [B]sizeInInches()[/B]. Also, watch it, your [B]sizeInInches()[/B] function is not correct: you return the number of feet in inches but forget any extra inches there may have been in [B]inches[/B] before calling the function. Since you don't want to normalize or un-normalize, use a local variable …

Member Avatar for balla4eva33
0
100
Member Avatar for niki01

You are asking the wrong kind of question (please read the [URL="http://www.daniweb.com/forums/announcement8-2.html"]Announcements[/URL]) and in the wrong forum (this is C++ Software Development, not the Tech Talk forum). Please spend some time with your textbook, googling, and thinking about the concepts you have learned so far. I doubt your professor will …

Member Avatar for niki01
0
127
Member Avatar for tech2chill

Forgive the apparent pun, but you need to observe the pattern of your image. For illustration I'll supply my own example image here: [code] [color=red]......[/color]ABCDEFGFEDCBA [color=red].....[/color]ABCDEF[color=green]...[/color]FEDCBA [color=red]....[/color]ABCDE[color=green].......[/color]EDCBA [color=red]...[/color]ABCD[color=green]...........[/color]DCBA [color=red]..[/color]ABC[color=green]...............[/color]CBA [color=red].[/color]AB[color=green]...................[/color]BA A[color=green].......................[/color]A [/code] There is a pattern to each line. The first pattern is that the number of red dots (representing …

Member Avatar for tech2chill
2
479
Member Avatar for need_Direction

The problem is that [B]pos2[/B] is finding the same space character as [B]pos[/B]. Essentially you are doing this: [code] pos = string( "Hello, world!" ).find( " " ); pos2 = string( "Hello, world!" ).find( " " ); [/code] The same space is found each time. The find() function takes a …

Member Avatar for need_Direction
0
120
Member Avatar for agrawalashishku

An integer is represented (by humans) thus: [inlinecode]1234[/inlinecode] 1 is in the thousands place 2 is in the hundreds place 3 is in the tens place 4 is in the ones place Each place to the left is times 10. So: 1234 div 10 is 123 R 4 123 div …

Member Avatar for Duoas
0
85
Member Avatar for Fredszky

The [B]strstr()[/B] function [inlinecode]#include <string.h>[/inlinecode] will return whether or not a given string contains a given substring. [code=C] char string_to_search[] = "Hello, world!"; char string_to_find[] = "world"; char *pos; pos = strstr( string_to_search, string_to_find ); if (pos != NULL) printf( "found it at index %d\n", (int)(pos -string_to_search) ); else printf( …

Member Avatar for Fredszky
0
105
Member Avatar for mrmonkee

[color=orange][B]interfacing with the console[/B][/color] If on Windows you'll have to use the (non-standard) stuff in <conio.h>. Just include the library file and compile. If on linux you'll have to use the curses library. There are various versions of it: [B]curses[/B], [B]ncurses[/B], and [B]pdcurses[/B]. You are sure to have at least …

Member Avatar for jbennet
0
2K
Member Avatar for adrive

That was my first thought too, but I realized that very problem would occur. Having thought it over some the answer is embarrassingly obvious: just cut and paste the text. Hope this helps.

Member Avatar for adrive
0
118
Member Avatar for clski1973

Welcome to the world of programming. All I can say is: it gets better. The C++ compiler (especially with the STL) is not a very sympathetic complainer. Show us what you've done: algorithm, code, errors, etc. and we'll help you think your way through it. Don't feel bad or give …

Member Avatar for Duoas
0
308
Member Avatar for coolbreeze

You're looking fairly good. 2. You are given an [B]istream[/B] named [B]inFile[/B]. You need to create two floats: one named [B]x[/B] and the other named [B]y[/B]. Remember that [B]cin[/B] is also an [B]istream[/B] (so you can use your file stream just like you use [B]cin[/B]). 6. Remember, 7.987... rounds to …

Member Avatar for WaltP
0
90
Member Avatar for BensonRoss

Or you could just use the [B]strspn()[/B] function: [inlinecode]if (strspn( dnaStr, "AaTtCcGg" ) < strlen( dnaStr )) puts( "error in DNA" );[/inlinecode]

Member Avatar for Aia
0
183
Member Avatar for jobs

Float types are just the hardware's floating point data type. Usually this is an IEEE single (4-bytes), double (8-bytes), or extended (10-bytes). The problem with these is that they [I]approximate[/I] numbers. Hence, they are not very exact. They lack precision and they are susceptible to the influences binary arithmetic. The …

Member Avatar for Duoas
0
382
Member Avatar for monto

I'm not sure what you mean. Do you mean that you want to execute another exe from your program? You can do that using the [B]system()[/B] function or one of the [B]exec[/B] functions in [inlinecode]<unistd.h>[/inlinecode]. Hope this helps.

Member Avatar for Duoas
0
79
Member Avatar for keef12345

Hey there, I've been playing around with a WSH script that could do it for you. However, I need to know, are you using XP?

Member Avatar for Duoas
0
91
Member Avatar for hamkakf

Everything happens when you hit the [Process] button. So add an OnClick method and inside that just check to see what value edit1.text string is, and set the other edit text strings appropriately. Good luck.

Member Avatar for Duoas
0
88
Member Avatar for gehad3003

[B]Siddhant3s[/B], please stop giving people code. Read the [URL="http://www.daniweb.com/forums/announcement8-2.html"]Announcement[/URL]. The purpose of the forum is the [I]help people learn[/I], not get us banned from schools.

Member Avatar for gehad3003
0
799
Member Avatar for ickle2

Whenever you read the word "structure" always think [B]record[/B] (or [B]class[/B], but you haven't gotten that far yet...). So create a record with a string for the person's name and some numbers for his birth date. Then, when reading the file, be careful to pay attention to the shape of …

Member Avatar for Duoas
0
132
Member Avatar for pacman326@gmail

If I understand what you want to do correctly, you want to do something like an associative array or a map where the first array simply indicates what type of thing is in the second array? So: [inlinecode]if (keys[ n ] == "name") cout << "Name = " << values[ …

Member Avatar for pacman326@gmail
0
242
Member Avatar for rugae

Both your teachers are full of crap. Use ==. Keep in mind, though, that == is limited to an [I]exact[/I] match comparison and only returns bool. You can get a little more information back using functions like [B]string.compare()[/B]. Hope this helps. [EDIT] I should give a little more info. For …

Member Avatar for vijayan121
0
206
Member Avatar for maddog39

It sounds to me like your child process is misbehaving. May I ask which command you are executing?

Member Avatar for maddog39
0
136
Member Avatar for sandhyamanheri

You have a good general idea of what you are doing. However, you need to pay attention to what [I]type[/I] of thing you are handling, and where your pointers currently point. In your [B]show()[/B] function you have improved some. Let me add some commentary that might help you: [code=C++] void …

Member Avatar for Duoas
0
127
Member Avatar for toucan

You can't. What you can do, though, is have another string with all your other data, which you use to copy the valid characters to from the original string. Once you find a punctuation character, print the second string using the function given to you, then use the second string …

Member Avatar for Duoas
0
1K
Member Avatar for joygqy

Your question is much too vague for me to help you. What is it you wish to classify?

Member Avatar for Duoas
0
90
Member Avatar for sumachitti

Please read the [URL="http://www.daniweb.com/forums/announcement125-2.html"]announcements[/URL]. If you can come up with a good idea of what you want to do and how to do it we can help you along. Post back with some (substantial) code.

Member Avatar for Duoas
0
46
Member Avatar for skatamatic

There is no way to do this without system dependencies. C++ doesn't know anything about the output device, so if you want to play with it you have to know something about it. It is possible to write your C code to choose to compile specific options depending on what …

Member Avatar for WaltP
0
2K
Member Avatar for Azurea

I recommend the [URL="http://gcc.gnu.org/"]GCC[/URL]. It comes with C and C++ and is fully standards compliant. If you want an IDE I'm not sure. Maybe someone else has a suggestion for that...

Member Avatar for ithelp
0
119
Member Avatar for federico090

Everything after [B]db[/B] is a byte. This sequence of bytes is obviously meant to be used as a character string, so everything in it is a character. 13, 10 is the ASCII character codes for CR and LF, meaning Carriage Return and Line Feed. In other words, it will print …

Member Avatar for federico090
0
80
Member Avatar for tracethepath

Watch your fencepost conditions. [B]j[/B] can become negative. Try tracing your sort using this input: [code] arr3 = 1 3 7 2 9 0 5 j i temp = 3 [/code] Good luck.

Member Avatar for tracethepath
0
86
Member Avatar for ashblynn02

First, a short rant. Professors love to use stuff like this because it doesn't exist in real life and nobody will know how to help you (or help you cheat... but I won't do that). I had to go download all the stuff off of your textbook's website to learn …

Member Avatar for Duoas
0
2K
Member Avatar for nikolaos

You have two problems that I see. The first is that you are using the struct tag without the struct keyword: [inlinecode]korifi *a[100];[/inlinecode] I think you meant to say this: [inlinecode]kdiktis a[100];[/inlinecode] The next problem is that you are throwing memory away: [code] root->a[s] = (kdiktis)malloc(sizeof(struct korifi)); // allocate big …

Member Avatar for Duoas
0
163
Member Avatar for JJarvis

I didn't know you could make applets using Pascal... Are you sure you aren't using Java or somesuch? Either way, remember that your substitution cipher is composed of two separate pieces of information: the code word and the remaining alphabet: [inlinecode] code word + remaining alphabet [/inlinecode] You can consider …

Member Avatar for Duoas
0
943
Member Avatar for Ratte

No, the call to [B]fork()[/B] is correct --I see nothing wrong with it. You are aware that this is a *nix system function and it will [I]not[/I] work on Windows, right? I'm not sure what you are trying to do with the signal. Are you trying to make a pointer …

Member Avatar for Ratte
0
464
Member Avatar for H a R o O n

I think this will do what you want: [code=Tcl] proc main {ip port} { set connection_to_server [socket $ip $port] puts $connection_to_server "Hello TCP-IP World\n" close $connection_to_server } main 127.0.0.1 6789 [/code] If you need your tcl script to be directly executable from the command line I'll need to know more …

Member Avatar for Duoas
0
506
Member Avatar for dasani

You are very close. You just need to add a couple of things to your loop. [code] #include <iostream> using namespace std; int main() { // The sum of no numbers is zero, so... float sum_of_positive = 0.0; float sum_of_negative = 0.0; for (float counter=-2.3; counter <= 3.0; counter+=.4) { …

Member Avatar for Duoas
0
1K
Member Avatar for toxic

> PS: memcpy is safer No it's not. It will try to copy [B][I]n[/I][/B] characters whether it hits an architecture-dependent read boundary or not. Use [B]strncpy()[/B]. It is fully standard and stops in the right place. To convert a string to an integer [inlinecode]#include <cstdlib>[/inlinecode] and use the [B]atoi()[/B] function: …

Member Avatar for Duoas
0
17K
Member Avatar for helixkod

C++ doesn't really know the difference between an [B]int[/B] and a [B]char[/B]: both are just numbers but one is typically 8 bits wide and one is typically 32 bits wide. I/O routines know that the string of numbers you give it are meant to be printed as ASCII if it …

Member Avatar for vijayan121
0
197
Member Avatar for phylon

I'm sure you are getting a perfectly fine return value. Your problem is that you have not supplied any type information that the compiler can use to "know" about your array. First, please see the Wikipedia [URL="http://en.wikipedia.org/wiki/C_syntax#Multidimensional_arrays"]here[/URL]. Next, please be aware that only the [I]first[/I] dimension can be [] in …

Member Avatar for mank
0
102
Member Avatar for csy

I've not messed with MDI forms much, but when you create your mainform you have to modify some of the application's system window properties. [code] procedure FormCreate(...); begin exstyle := getWindowLong( application.hanle, GWL_EXSTYLE ) end; procedure FormShow(...); begin setWindowLong( application.handle, GWL_EXSTYLE, exstyle ) end; procedure FormHide(...); begin setWindowLong( application.handle, GWL_EXSTYLE, …

Member Avatar for csy
0
714
Member Avatar for csy

How did you add it? (Did you use some component you got off the web or did you use the [B]Shell_NotifyIcon[/B] function?) Changing the icon is simply a matter of using [B]NIM_MODIFY[/B] with a different icon handle in the [B]hIcon[/B] field of the same [B]NOTIFYICONDATA[/B] record you first used to …

Member Avatar for csy
0
236
Member Avatar for pogosecure

Neither language can do this. "Bold" is a feature of your output device. What kind of output device are you using? Is it a console window? (If so, what OS?) Is it a Windows Rich Edit control? Is it something else? Let us know and we can give you some …

Member Avatar for Duoas
0
43
Member Avatar for Duki

Erm, the program is doing exactly what it is told to do. The error is that it is doing something you would prefer it not to do? Or that it is not doing something you would like it to do? Whenever you are getting a string from the user at …

Member Avatar for Ancient Dragon
0
124
Member Avatar for mqueene7

The [B]size[/B] variable is a [I]variable[/I]. The compiler does not know what value it might hold at any given time. Since you are using C++, you should be using a [B]vector[/B] or [B]deque[/B] for this instead of an array. But if you must use an array, just make one as …

Member Avatar for Duoas
0
121
Member Avatar for chorei

To calculate Fibonacci numbers you don't need a lookup table... Remember, each successive term is the sum of the previous two. Hence, you only need to remember two numbers at a time. Use a loop to find the nth term you want. [code] if n == 0 return 0 if …

Member Avatar for iamthwee
0
252
Member Avatar for sgk26p10p07

There's a blurb over on [URL="http://en.wikibooks.org/wiki/X86_Assembly/Protected_Mode#Entering_Protected_Mode"]WikiBooks[/URL] about entering protected mode. I've never done it (nor do I care to) so I know nothing about it. However, if you are not doing all of the things listed there your pc will decide that something is horribly wrong and reboot. Hope this …

Member Avatar for Duoas
0
69
Member Avatar for #include_rose

I hope that your struct was just missing the element part: [code] typedef struct [B]element[/B] { int data; struct element *next; } node; [/code] You aren't likely to compile properly if you use struct element without first tagging it... Hope this helps.

Member Avatar for #include_rose
0
295
Member Avatar for jrice528

Er, sure I have time for one more... Don't use [inlinecode]system("pause");[/inlinecode]. Tell your professor it is evil and non-portable and he shouldn't be teaching it. If he gives you a hard time tell him people who know better than he know better. (Yes, I know that sounds non-sequitur, but he …

Member Avatar for AnthIste
0
138

The End.