101 Posted Topics

Member Avatar for thecstudent

exactly...he can simply use a common header, a isPrime.c, a genPrime.c and finally a main.c which calls the two. Inside genPrime.c he can simply call isPrime(n) which is inside isPrime.c. Offcourse he needs prototypes or a common header. Edit: offcourse,you need to compile the files together. If you are using …

Member Avatar for thecstudent
0
309
Member Avatar for Ali5152

you have mixed "case" in your code. If the code that you have posted is what you are trying to compile then consider the following changes: first (as vinitmittal2008 suggested) change line no. 13 to match exactly what he said, and i repeat: [CODE]typedef struct LinkedList NODE;[/CODE] observe "LinkedList" as …

Member Avatar for NP-complete
-2
388
Member Avatar for networkZombie

okay, firstly, repeat this a 100 times, "I'll never call main() from other functions" main() is supposed to be called by the OS, and it will get really angry if you call it instead..!! so remove all those calls to main() (line no. 31 to 33) and you'll get out …

Member Avatar for Dingbats
0
273
Member Avatar for MyPianoSucks

may be you'll just need to put a cin.getchar() right before you return from main(), or a suitable breakpoint... can't tell you more than that without looking at the code...:)

Member Avatar for MyPianoSucks
0
191
Member Avatar for berwick53

@Jmknight...he's obviously using windows...don't know about xp... @berwick53 Are you sure you are giving your input in UPPERCASE ? otherwise your 'if' in line 112 will fail and you'll get that "this program stopped working" error (a stack overflow), which i presume is what you'r getting...right? first solve this and …

Member Avatar for NP-complete
0
87
Member Avatar for kerek2

Come out of your dizziness and think and code something solid. So far you have simply taken an input. You have not done anything about the logic so far. Also, the question itself is a bit gibberish. Please be more specific about what you want to do.

Member Avatar for kerek2
0
144
Member Avatar for g2gayan

@prisonpassioner :-O ? u better read all the posts before giving out your "solution" otherwise it leads to something called redundancy. Also, from next time, be more specific as your posts are indeed "gibberish".

Member Avatar for g2gayan
0
139
Member Avatar for xaop

Firstly, the two of you should have explained where the OP went wrong, before giving out your (wrong, unoptimized, non-standard, non-indented) code. @shikhin: your code is WRONG A thought about optimization: the looping can be done only up to the square root of the number. You need not go up …

Member Avatar for technology
0
737
Member Avatar for john butler

well, abstract classes are "abstract" and provides "abstraction". That's one way to look at it. Think of it like this: They don't allow you to create objects, right? Now, why do you think that is required? Lets take an example, say we have a Human class which has two subclasses, …

Member Avatar for musthafa.aj
0
114
Member Avatar for seanvitalaim

the first two errors are trying to say that they found string but you are trying to assign those strings into chars. Solution: Make L1 and L2 Strings. For the next two: I hope you can understand that you haven't declared the variables 'gpa' and 'total'. For the remaining errors, …

Member Avatar for NP-complete
0
151
Member Avatar for JoBe

@ pvfloripa: Do you think that after 4 years the OP is still in search of a "best" solution? Also this thread was marked solved!! You are new to daniweb, so in future keep this in mind - you should not post in very old threads (and this one was …

Member Avatar for NP-complete
0
272
Member Avatar for fsl4faisal

Well, here's a quick answer for the difference b/w abstract classes and interfaces : Abstract classes can contain both abstract as well as non-abstract(concrete) methods. Interfaces can only contain abstract methods. NO non-abstract (concrete) methods are allowed inside an interface. In other words, interfaces are 100% abstract classes. Hope this …

Member Avatar for NP-complete
0
197
Member Avatar for fsl4faisal

Dont hide your questons inside your unformatted code which is even without code tags. Be specific about your problem. That way we can help you better. Keep that in mind and read the community rules before posting. Good Luck.

Member Avatar for JamesCherrill
-2
110
Member Avatar for maira74

@ parse : Dont give out codes and that too codes that don't stick to the specs. For eg you were supposed to declare and initialize separately but you did them together. Also, when the OP was asked to study and then come up with a better solution you should …

Member Avatar for NP-complete
0
238
Member Avatar for xaop

@tesu: The algorithm is correct. Its just that the first tw0 terms of the series must be printed separately. fibo(18) is 2584 iff fibo(0) = 0. So what you are printing as your first term should be the 2nd term (ie fibo(2) if we take the first term as fibo(0)). …

Member Avatar for xaop
0
195
Member Avatar for c++learner

@Andreas5 : the OP didn't want to have two functions. Though overloading could have been a possible (and perhaps more elegant) way of doing it but we possibly cannot go beyond specs...:) @c++learner : I hope you understood what jonsca suggested. As far as return statements are concerned do a …

Member Avatar for NP-complete
0
1K
Member Avatar for shankarz

@shikhin : you forgot the [B]&[/B] in scanf :) it should be: [CODE]scanf("%d", &i);[/CODE] @shankarz: I hope the explanation given by shikhin is clear to you. I'll just summarize what he said: [B]Declaring[/B] a variable means to tell the compiler about the type of the variable : [CODE]int myVariable;[/CODE] [B]Initializing[/B] …

Member Avatar for Banfa
0
197
Member Avatar for empror9

okay, taywin already gave you an algorithm to approach the 2nd problem (about sine series). I guess you are having problems following it, so here's a bit more detailed description: Firstly look at the series carefully. There are three important things to consider. 1) You have to calculate powers...(use library …

Member Avatar for Agilemind
0
349
Member Avatar for student.09

Think practically...do you throw away remaining cookies?? I guess you don't need to round off the no. of boxes/cases. Lets take a small example. Say the #ofCookies = 25. Then how many boxes do you need to cover all the cookies? Well, you need 3. Two boxes will contain 10 …

Member Avatar for NP-complete
0
117
Member Avatar for empror9

hi, i have already explained your third question(the sine series) in your previous thread "three simple questions" Here's the link: [URL="http://www.daniweb.com/forums/post1265376.html#post1265376"]http://www.daniweb.com/forums/post1265376.html#post1265376[/URL] Please go to this thread and end the discussion. Don't use different threads for same problems. If you are satisfied with your previous set of questions and the help …

Member Avatar for NP-complete
0
98
Member Avatar for empror9

firstly i congratulate you for your attempt on "being the compiler" and checking the code as the compiler would have. That's a nice approach. But unfortunately the compiler is not as logical about logical operators as it should have been. There's something called "operator precedence" which kills the fun. So …

Member Avatar for hsh44
0
183
Member Avatar for Chichiro

First things first....I am an Indian and yet with a heavy heart I believe in most of the opinions put forward so far in this thread. [B]I wish more Indians read this thread and more could THINK before going in blindly for quantity over quality.[/B] As already mentioned these for-profit …

Member Avatar for vaultdweller123
0
548
Member Avatar for david cashin

One more thing, BlueJ is NOT a compiler. Its just an IDE. The compiler is within the jdk file that you probably have downloaded from sun. To compile a .java file without blueJ is simple. First you need to set a classpath for the bin subdirectory inside your jdk directory. …

Member Avatar for NP-complete
0
2K
Member Avatar for moroccanplaya
Member Avatar for eshabajaj
Re: C

[URL="http://lmgtfy.com/?q=C character set"]try this...[/URL] P.S: thanks ketsuekiame, i got this idea from you. :)

Member Avatar for Banfa
0
88
Member Avatar for nanosani

Anar Diabo, do you think the OP still needs an answer? After ~FOUR years?? I think she might have got it by now or have lost all hopes and have downloaded a few custom made ones... sakshamkum: great that you are working on a similar project. We wish you all …

Member Avatar for peter_budo
0
166
Member Avatar for yasaswyg
Member Avatar for manutd4life

well, here you go... [CODE]//first think of the max length of your array and make it a constant; const int MAX_SIZE = 256; //then declare your array char sentence[MAX_SIZE]; //now you need to ask the user to enter something printf ("please enter the string \n"); //now comes the main part...storing …

Member Avatar for manutd4life
0
166
Member Avatar for Ferny84
Member Avatar for bsse007

it seems that you have not bothered to STUDY about classes and objects. Otherwise this is just a very simple code regarding basics of classes and objects which after a good introduction to OOP you could have easily solved. Here's a link that may be helpful: [URL="http://www.cplusplus.com/doc/tutorial/classes/"]http://www.cplusplus.com/doc/tutorial/classes/[/URL] Also, google is …

Member Avatar for NP-complete
0
186
Member Avatar for Abiha

What the hell is this?? Are u joking with us?? Or is it that you are as stupid as it seems...!!!

Member Avatar for NP-complete
-2
1K
Member Avatar for iamcreasy

If your looking for OOP design then you can give this book a try: "Head First Design Patterns" from O'Reilly. It's very good. Regarding UML you only need to learn a few basics and the rest will come along as and if you work with it. For that you can …

Member Avatar for avarionist
0
171
Member Avatar for manutd4life

I suppose you need to enter the salary once?? Or do you have to enter it every time (that's not in the specs) If the former is the case then you need to change (decrement) your final sum inside the loop. Otherwise how will it ever become less than 1000 …

Member Avatar for Tellalca
0
92
Member Avatar for iRemember

well, it seems you are out of scope with some variables, particularly the cardTotal variable. For e.g. the cardTotal you declared in line no. 25 is not the same as the one in line no. 106. The one declared in the Check method dies out as you go out of …

Member Avatar for jwenting
0
99
Member Avatar for appunu

IMHO you must change line no. 9 to something like: [CODE]else if (a==b && b==c && c==a)[/CODE] The advise that finito gave you can be considered but that's not the concern in this case. Your logical checking is not right. Actually your version will only work if you input all …

Member Avatar for NP-complete
0
121
Member Avatar for ifezuec

Well ifezuec, if you are wondering whats a struct...its just like a class with everything (data members as well as member functions) public by default. If you wanted strictly a class you can simply replace the "struct" with "class" but in that case your 2d matrix will no longer be …

Member Avatar for NP-complete
0
72
Member Avatar for comput scince

what you want is not clear. If your talking about interfaces as in JAVA, then as far as I know C doesn't have anything called interfaces (correct me if I am wrong). If you are talking about anything else, like an user interface or something like that then be specific. …

Member Avatar for comput scince
0
89
Member Avatar for madonline

i think you are slowly going towards a homework assignment....first malloc then linked list now perhaps you would ask how to add nodes or delete them...:) well, here's a link that might be some good to you.... [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/"]http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/[/URL] P.S: In C++ why would you like to use "malloc" anyway. You …

Member Avatar for madonline
0
125
Member Avatar for MrDiaz
Member Avatar for MrDiaz
0
123
Member Avatar for SweetDeath

IMHO, I think you'll have to change your youngest_women function to something like: [CODE]void youngest_women(){ int m=0,y=age[0]; for(int i=1;i<count;i++){ if(sex[i]==1){ if(y>age[i]){ y=age[i]; m=i; } } } //end of for cout<<"The youngest women visited Bulgaria is: " <<Fname[m]<<" "<<Sname[m]<<" "<<Lname[m]<<" at age of "<<age[m]<<" from "<<country[m]<<endl; }[/CODE] First of all your …

Member Avatar for SweetDeath
0
115
Member Avatar for bobbyg118
Member Avatar for smart99

I think the best book for beginners to LEARN java is "Head First Java" by Kathy Sierra and Bert Bates. I simply enjoyed the book. Once you grab the concepts you can move to books like "Core Java" vol. 1 and vol. 2 by Cay Horstmann et al . These …

Member Avatar for NP-complete
0
73
Member Avatar for xzero_x

as far as your code is concerned, no difference at all. Every class implements those two anyway. It depends on what you want to do with Comparable. If you want to make a list of all houses and "sort" them based on the compareTo method then you can perhaps use …

Member Avatar for NP-complete
0
90
Member Avatar for socal

And for that overdraft method not working.... Its the same problem as is with your constructor. You are NOT passing the correct number of arguments to it.(Madawar actually tried to tell you this only) Hope it helps.

Member Avatar for NP-complete
0
123
Member Avatar for noobuser

if you don't know already, daniweb only helps people who show at least some efforts. Just saying "help me please" wont help (and that too for homeworks!!) First try yourself. Post what you are thinking. If you have managed to write any code so far then post that too. This …

Member Avatar for abhimanipal
0
88
Member Avatar for programing

What have you done so far?? If you are fine with nos...chars are not that different. Post the code that you have written so far.

Member Avatar for NP-complete
0
150
Member Avatar for tendavola

may i know which compiler you are using? You surely have array out of bounds in line 24. Also may i know the headers you are including??

Member Avatar for NP-complete
0
105
Member Avatar for Jack_1

@amrith92: [QUOTE]Now, for any given number, the maximum value of the factor it can have is always less than or equal to its square-root[/QUOTE] That's wrong. For e.g. sqrt(16) = 4 but factors of 16 are 2,4,[B]8[/B] (and off course 1). What you said is true for prime factors (that …

Member Avatar for NP-complete
-1
151
Member Avatar for bladethebric

How many times do you want DANIWEB to remind you of CODE TAGS?? They are so sick and tired that they have also watermarked "please wrap code in code tags..." in every "post reply" message box. Still you guys can't see. Its a shame. I also found that you have …

Member Avatar for NP-complete
-2
254
Member Avatar for maryam ahmad
Re: pow

well i copied your code and tried to compile it. Looks like, other than line 22 of your code the rest will compile fine if you take jonsca's advice and make the call to pow as [code]pow(-1.0,i+k)[/code]. It just gives you a warning regarding possible loss of precision. The second …

Member Avatar for Fbody
0
155

The End.