6,741 Posted Topics

Member Avatar for RexxX

>My friend told me to use byte variables instead because they have 8 bits. A byte doesn't have to be 8 bits. >What the hell?? C doesn't have any kind of "byte" keyword. If you want a byte, use unsigned char. >I figured byte would solve my problem. Somehow I …

Member Avatar for Narue
0
139
Member Avatar for mrnutty
Member Avatar for ddanbe
1
309
Member Avatar for Skeen

[B]>I've tried stuff like srand(time) in main, however, that doesn't apply to the class[/B] And if you do it in, say, the constructor, what do you expect will happen when you create two objects of that class? The seed is global. Anytime you call srand, the seed will change for …

Member Avatar for Skeen
0
112
Member Avatar for frankenclyde

[B]>is there anyone who is kind enough to share a program code[/B] Nope. We're all meanies who make you do your own homework. However, if you try it yourself and encounter problems, we'll be happy to help you solve those problems.

Member Avatar for Narue
0
27
Member Avatar for kele1

[B]>Please help me out thank you. [/B] Sorry dude, but you didn't ask a [URL="http://www.catb.org/~esr/faqs/smart-questions.html"]question[/URL]. I'm not inclined to help you when your request for help smells like you're saying "please do it for me!!!11".

Member Avatar for kele1
0
143
Member Avatar for Happy Family

So basically you don't know how to write the program and want us to hold your hand (or do it for you). Sorry, but no go. You'll have to work a little harder than that for your code to count as [URL="http://www.daniweb.com/forums/announcement8-2.html"]proof of effort[/URL].

Member Avatar for Narue
-1
84
Member Avatar for akim_atl

>I am all confused, I don't where to start. Somewhere, [I][B]anywhere[/B][/I], even if it's completely wrong. If you have to, write a hello world program and build on it. The last thing you want to do is fall into a hole of not knowing what to do and being afraid …

Member Avatar for virgo_norz
0
1K
Member Avatar for new programer

[B]>how did you choose your major?[/B] Not applicable. I didn't go to college. [B]>what if you like everything in a scope?[/B] You do realize that you can learn things on your own, right? Classes aren't necessary. [B]>what if you're a geek !![/B] Watch out for jocks? [B]>Things in mind are: …

Member Avatar for new programer
0
475
Member Avatar for miskeen

[B]>I've read that global variables should be defined once and declared >in evry file using those variables using the keyword extern?[/B] Yes, that's a safe guideline. I'd do it like the following though, because it's easier to be explicit than get bitten by some of the more obscure declaration/definition rules: …

Member Avatar for gerard4143
0
931
Member Avatar for suho

[B]>delete (particles+i);[/B] You can only delete addresses that were returned by new. [ICODE]particles+i[/ICODE] will only reference such an address if [ICODE]i[/ICODE] is zero. The whole of [ICODE]particles[/ICODE] can be released in a single statement (no loop necessary): [code] delete[] particles; [/code] Your code suggests that you're confused about the difference …

Member Avatar for Narue
0
125
Member Avatar for sarahharris

I guess you can chalk this up as a lesson learned. What you're asking us to help you with amounts to gaining unauthorized access, discussion of which is against Daniweb's policies. I can guarantee that if you continue this line of inquiry, bad things will happen.

Member Avatar for Nick Evan
-1
177
Member Avatar for MAV_DevWantaB

[B]>strcpy( *revrseStrng, string );[/B] I don't know what you imagined this to do, but there's no magic in C. If you want to build a string from the tokens of another, you do it just as one would expect: [code] while more tokens get token append token to string print …

Member Avatar for Narue
0
2K
Member Avatar for Neon87

[B]>why are the \n ignored and treated as strings?[/B] My guess would be the file contains literal "\n" instead of actual newlines. It's hard to say without more detail from you, like the contents of the file as well as the code you're using to read and print the string. …

Member Avatar for Neon87
0
132
Member Avatar for anonymous alias

[B]>this is a joke. I mean, seriously, did anyone here take any math classes in college?[/B] It's a fair assumption that the points are weighted somehow. Are you interested in an answer or are you just here to bash things you don't understand? Because if it's the former, being a …

Member Avatar for diafol
-2
414
Member Avatar for Neon87

[B]>if A goes out of scope does this mean the pointer B is a >bad pointer meaning it does not point to anywhere?[/B] Yes, B is a bad pointer. It still points to somewhere, but the address it points to is a destroyed object, or (even worse) a new object …

Member Avatar for Narue
0
100
Member Avatar for winecoding

[B]>How many constructor (including copy constructor) >and destructors will be called for test1 and test2?[/B] Zero. test is redefined and thus the code won't compile. test1 and test2 are neither declared nor defined, thus the code won't compile and certainly won't link.

Member Avatar for Lawand
0
85
Member Avatar for Stefano Mtangoo

[B]>1. What is your favorite IDE[/B] I'd have to say that I prefer Visual Studio due to relative ease of use (mostly from the debugger). [B]>2. What is your favorite GUI library[/B] I equally dislike all of the ones I've tried. [B]>3. What is library that you often use?[/B] The …

Member Avatar for Lawand
0
139
Member Avatar for lewashby

[B]>What's [taking] me so long to learn what I need to learn to get the job?[/B] At the risk of sounding harsh, I'd say the fact that you're not suited for the field is what's taking you so long. Why do I think this? [list=1] [*]You strike me as having …

Member Avatar for Narue
0
95
Member Avatar for raghuhr84

[B]>scanf("%[^\n]s",&str1);[/B] Scansets are a specifier on their own, not a part of the %s specifier. This format string reads up to a newline, then tries to match the character 's'. In your specific case it's not going to cause a problem, but if you try to convert anything after that, …

Member Avatar for Dave Sinkula
1
689
Member Avatar for Spreegem

[B]>How could I take something like that and make it recursive?[/B] Loops are simulated using recursion, so your first step should be to take the loop and turn it into recursive calls without losing the changes made to local data. The condition of the loop represents a base case, so …

Member Avatar for Nimmy Chohan
0
184
Member Avatar for pmee

Change your printf line to this: [code] printf ( "Hex: %s Bin: %08s\n", hexNum, binaryNum ); [/code]

Member Avatar for iAmLast
0
978
Member Avatar for Robyy14

[B]>while(!EOF){[/B] Good luck with this doing anything meaningful. :icon_rolleyes: [B]>Killed by signal 8(SIGFPE)[/B] Did you look up SIGFPE? The name means that a floating-point exception occurred, but the signal is actually thrown on general arithmetic errors. Normally I'd say to check your math, but your code is actually quite broken …

Member Avatar for Robyy14
0
11K
Member Avatar for vmanojnair

It's a good thing you narrowed down the topic so that we can help you. :rolleyes: Here's an idea: Take the initiative and do something that interests you instead of just being a mindless student who sits around with his thumb up his ass waiting for someone else to tell …

Member Avatar for peter_budo
-4
675
Member Avatar for nedsnurb

It looks like you've got it figured out. No changes need to be made to bubbleSort or print. The only difference is swapping out the array for the pointer, and the code for getting a size from the user as well as performing the memory management.

Member Avatar for mrnutty
0
2K
Member Avatar for DarthPJB

[B]>How, without using a library written by someone else <snip> can I >possibly write my model files on one platform, and load on another >without either: using text files, or wasting space in my file?[/B] Your problem is binary. Any binary output is inherently non-portable, and the only way to …

Member Avatar for DarthPJB
0
305
Member Avatar for merse

[B]>What is the timeline for the compiler? >If i create an object myclass myobj(...) >the first is the myclass constructor call, >or the myclass data member declaration?[/B] The constructor is a magic function. You can think of it like this: [code] class foo { int x; public: foo() { x …

Member Avatar for Narue
0
136
Member Avatar for merse

You can specialize myclass::function based on the template parameters of myclass: [code] #include <iostream> struct mystruct {}; template <class T> class myclass { public: T function() { std::cout<<"Generic template\n"; return T(); } }; template<> int myclass<int>::function() { std::cout<<"int specialization\n"; return int(); } template<> double myclass<double>::function() { std::cout<<"double specialization\n"; return double(); …

Member Avatar for merse
0
141
Member Avatar for charlichickxx

Segmentation faults come from trying to access memory that you don't own. In a linked list, this would be trying to dereference a null pointer, or access an invalid pointer. [B]>current_player = current_player->next = victim;[/B] Hey look, and invalid pointer! You forgot to initialize victim.

Member Avatar for jephthah
0
763
Member Avatar for Gem74

[B]>current = new Node ; // creates a new node[/B] This uses the default constructor.

Member Avatar for Gem74
0
2K
Member Avatar for jodie121997

I'd recommend that you reconsider your design. This kind of thing suggests that your design is awkward and ill-suited to C.

Member Avatar for Narue
0
498
Member Avatar for DCV

[B]>Adjust(heap, heap[1], j);[/B] At a glance of the code, I really don't think heap[1] is an appropriate index in this call. It should probably be 1. ;)

Member Avatar for Narue
0
135
Member Avatar for xavier666

[B]>So, in a nutshell, I'm looking for an alternate of the non-standard getch();[/B] Unfortunately, you can't do it in one line without making some assumptions or rolling the whole thing up into a function. Assuming you want to convert this program: [code] #include <stdio.h> #include <conio.h> int main ( void …

Member Avatar for xavier666
0
155
Member Avatar for masapo

[B]>made by: Fahad [/B] You shouldn't admit to writing code like that.

Member Avatar for Narue
0
119
Member Avatar for speedy94519

[B]>there is nothing in C demands that TRUE = 1 and FALSE = 0.[/B] Depends on the context. If you mean at the language level, then yes, relational comparisons are required to treat zero as false and non-zero as true. [B]>for instance, i write device drivers following a popular >convention …

Member Avatar for Narue
0
295
Member Avatar for xman13157

Basics of Programming (by Narue): [list=1] [*]Find a problem to solve. [*]Understand the problem. [*]Figure out a solution to the problem. [*]Write code to implement the solution. [*]Debug the code you wrote. [*]GOTO 5 [/list]

Member Avatar for zobadof
-7
105
Member Avatar for merse

[B]>it is possible?[/B] Have you tried it? A lot of your questions can be tested with a compiler and a small bit of code.

Member Avatar for mrnutty
0
104
Member Avatar for discovery-power

This should be a good learning experience. I'd start by [URL="http://www.wikihow.com/Compile-a-C-Program-Using-the-GNU-Compiler-%28GCC%29"]manually compiling[/URL] your projects, then later you can move into [URL="http://www.cs.utah.edu/dept/old/texinfo/make/make_toc.html"]make files[/URL].

Member Avatar for discovery-power
0
118
Member Avatar for xavier666

[B]>But as soon as I posted some of my code snippets >here, immediately I got a stream of insults[/B] If you're insulted by people correcting your mistakes, you need to adjust your attitude. Why? Because unless you're some kind of C demigod, you're going to make mistakes and people will …

Member Avatar for xavier666
0
131
Member Avatar for mloC

[B]>Lines 124 and 132 contain the same two errors.[/B] I'll answer your question with another question: How many clauses does a for loop have? p.s. You also need to include the <string> header.

Member Avatar for mloC
1
96
Member Avatar for merse

Sadly, constraints are not a part of C++, and concepts (the design for constraints) have been dropped from the next revision of the standard. However, you can fake it using static assertions and template specialization: [code] #include <iostream> #define STATIC_ASSERT(condition) \ do \ char foo[condition] = {0}; \ while ( …

Member Avatar for mrnutty
0
246
Member Avatar for es cape85

[B]>plz help with the code in C which can calculate the fectorial of 500.[/B] The first thing you need to do is figure out how to do arbitrary precision arithmetic. 500! is a rather large number, after all: [code] 1220136825991110068701238785423046926253574342803192842192413588385845373153881997605496447502203281863013616477148203584163378722078177200480785205159329285477907571939330603772960859086270429174547882424912726344305670173270769461062802310452644218878789465754777149863494367781037644274033827365397471386477878495438489595537537990423241061271326984327745715546309977202781014561081188373709531016356324432987029563896628911658974769572087926928871281780070265174507768410719624390394322536422605234945850129918571501248706961568141625359056693423813008856249246891564126775654481886506593847951775360894005745238940335798476363944905313062323749066445048824665075946735862074637925184200459369692981022263971952597190945217823331756934581508552332820762820023402626907898342451712006207714640979456116127629145951237229913340169552363850942885592018727433795173014586357570828355780158735432768888680120399882384702151467605445407663535984174430480128938313896881639487469658817504506926365338175055478128640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 [/code] Last I checked, that value exceeds the range of …

Member Avatar for jephthah
0
98
Member Avatar for merse

Didn't we already go over this with you? If you want to call a member function through a const object, the member function should be qualified as const too: [code] #include<iostream> #include<math.h> class real { double value; double error; public: real(const double,const double); double get_value() const; double get_error() const; friend …

Member Avatar for Narue
0
116
Member Avatar for Natique

[B]>is there a way to make it ignore automatically? Without the message box appearing?[/B] Yes, fix the error that causes the message in the first place. Silencing an error doesn't make the error go away, it just makes it harder to fix when ignoring it [i]really[/i] breaks something.

Member Avatar for Narue
0
1K
Member Avatar for kavourdoukos

By default std::sort uses an overloaded operator< for the type, but you can pass a predicate to std::sort as the third argument: [code] #include <algorithm> #include <cstdlib> #include <iostream> bool compare ( int *a, int *b ) { return *a < *b; } int main() { const int n = …

Member Avatar for JasonHippy
0
156
Member Avatar for zainhamza

[B]>std::queue<std::string> prio_q;[/B] You know the standard library has a priority_queue class too, right?

Member Avatar for Narue
0
220
Member Avatar for Iam3R

[B]>[how does it] give a value that will not exceed the array size as choosen(101).[/B] It's done in the return statement with [URL="http://en.wikipedia.org/wiki/Modular_arithmetic"]modular arithmetic[/URL]. That's not my preferred method though, I prefer to return just a basic hash and let the caller fit the range. However, when you say h …

Member Avatar for Narue
0
109
Member Avatar for coolnani
Re: trie

[B]>i need a complete working program in TRIE data structure.[/B] Then you should get started on writing one. [B]>please help me out. at least post the links where i can find them.[/B] Sorry, we don't help people cheat on their homework. If you seemed like you wanted to learn about …

Member Avatar for coolnani
-1
83
Member Avatar for zortec

[B]>Why is there no way to delete a post?[/B] You mean besides preserving the flow of threads, disallowing malicious deletions, and helping people who visit the forum long after a thread has ended? I guess it's a restriction designed to annoy you personally. :icon_rolleyes: [B]>Anyway, the point is people make …

Member Avatar for zortec
0
145
Member Avatar for bhavz

[B]>how do i send this data using this func[/B] Either change the size of your buffer, or call the function multiple times. It really depends on how SendDataReq works.

Member Avatar for Narue
0
70
Member Avatar for fedya

[B]>restricted to use any of them, i should make my own one[/B] That's stupid. You're not likely to invent a sorting algorithm that hasn't been invented before, and yours is much more likely to suck ass than one of the existing popular ones. I think you need to confirm what …

Member Avatar for xavier666
0
6K

The End.