6,741 Posted Topics

Member Avatar for Charlton21

[QUOTE]wrap your code in code tags. <snip> template <class T> class myClass { T myMember; } template <class T> T myClass<T>::getSomething(){return myMember;} [/QUOTE] Oh, the irony.

Member Avatar for Narue
0
306
Member Avatar for lochnessmonster

[QUOTE]i was told objects can be created in C just like c++.[/QUOTE] Objects are really just lumping data and functions that operate on the data into one package. In C you can't have member functions, but you [i]can[/i] have pointers to functions: [code] #include <stdio.h> typedef struct foo foo; struct …

Member Avatar for Narue
0
182
Member Avatar for ahtaniv

[QUOTE]My understanding is that the Objects created are stored in the heap segment.[/QUOTE] Your understanding is incorrect. The location for an object depends on how it's created. [QUOTE]What if the objects are created for a class with static data members?[/QUOTE] The static data members are stored separately from instance data …

Member Avatar for ahtaniv
0
372
Member Avatar for amanoob
Member Avatar for pseudorandom21
-7
237
Member Avatar for daviddoria

The problem is easily solved by throwing type safety out the door: [code] class Base { public: virtual void GetData(void *data) = 0; }; template <typename T> class Derived: public Base { int _data; public: Derived(int data): _data(data) {} virtual void GetData(void *data) { *(int*)data = _data; } }; #include …

Member Avatar for mike_2000_17
0
242
Member Avatar for Kaushalya

Nothing magical going on here, but in an uncharacteristic move, I actually added comments. Yes, I'm bored: [code=cplusplus] #include <string> #include <vector> //! Maintains a collection of substrings that are //! delimited by a string of one or more characters class Splitter { //! Contains the split tokens std::vector<std::string> _tokens; …

Member Avatar for zwatsu13
0
14K
Member Avatar for Phinocio
Member Avatar for Josue198s
Member Avatar for RobZombie85
Member Avatar for Narue
0
154
Member Avatar for sowjanya.y

We're not programmers for hire. This forum is for people who want to do the work themselves and need a bit of help.

Member Avatar for Ancient Dragon
-2
46
Member Avatar for glenn_boy13

[QUOTE]I don't know how to prevent my other output to be cleared when I use clear screen.[/QUOTE] That's because clrscr clears the whole screen. :icon_rolleyes: The vanilla console doesn't lend itself well to non-linear drawing. You'd probably be better off either going full GUI, or take advantage of something like …

Member Avatar for Mouche
0
1K
Member Avatar for lochnessmonster

[QUOTE]how do you typedef a function?[/QUOTE] You don't. The code you posted is a typedef for a [I]pointer to[/I] a function.

Member Avatar for mike_2000_17
0
561
Member Avatar for Nandomo

I'm a little biased, but I believe [URL="http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]this[/URL] is a well written explanation. The code is in C, but the changes necessary to compile the examples as C++ are minor and pretty much just constitute an explicit cast.

Member Avatar for Nandomo
0
96
Member Avatar for tupac03

Sculpting, flower arrangement, ballet, and firework pyrotechnics. I would like to know the difference between these listed.

Member Avatar for chrjs
-3
115
Member Avatar for juangalvez4

Let's break it down a bit. A function has four parts: [list=1] [*]An identifier [*]A return type [*]A parameter list [*]A body [/list] The first three are combined to create the function's signature, and it looks like this: [I]<return type>[/I] [B]<identifier>[/B]([I]<parameter list>[/I]) The parameter list is enclosed in parentheses simply …

Member Avatar for pseudorandom21
0
137
Member Avatar for lara_

>It looks as if you are automatically assuming that Z is an integer That's a reasonable assumption seeing as how Z was declared as int. >When it's not an integer, but it's treated as one, you could end up in some sorta loop further down in your program. The problem …

Member Avatar for Hymppis
0
346
Member Avatar for snkiz

[QUOTE]it's not about anything I may or may not have posted, but about not wanting to be here at all.[/QUOTE] Then leave and don't come back. I fail to see what's so difficult about this. If you're worried about identifying information, you wouldn't have it anywhere on your account in …

Member Avatar for ~s.o.s~
0
461
Member Avatar for Vallnerik25

>So obviously I am missing a fundamental part of the logical not operator. Let's break it down, starting with the if statement: [code=cplusplus] if ( ... ) { ... } [/code] If the condition is true, execute the block. Simple, right? Now let's add a boolean test: [code=cplusplus] if ( …

Member Avatar for pkunzip1234
0
232
Member Avatar for lttleastig

[QUOTE]any idea what sort of cryptography that might be?[/QUOTE] The zero padding suggests a block cipher of some sort. If you're trying to generate passwords that are accepted by the game or decrypt passwords from the game, you're looking at some serious cryptanalysis. Not only do you need to figure …

Member Avatar for lttleastig
0
77
Member Avatar for vegaseat

The easiest solution is to first try opening one of the following streams: [code] ofstream pout("PRN"); ofstream pout("LPT1"); ofstream pout("PRN:"); ofstream pout("LPT1:"); [/code] If none of those work, and your compiler doesn't support an extension for talking to a printer, google over to MSDN and see what you can find. …

Member Avatar for abdullah0
0
221
Member Avatar for Asif_NSU

>Thanx for the great response :( Bite me. Now I'm not going to help you. But all is not lost because I found a C++ implementation of this on google that would give you a nice start. It took me about 7 seconds.

Member Avatar for elemes
0
1K
Member Avatar for CoderGuy101

[QUOTE]I see at SNIP that most computer jobs require a Bachelors degree.[/QUOTE] That's boilerplate these days, but a stronger degree will certainly help you get an interview when your resume is in a stack. [QUOTE]I just wanted to get an "idea" of where I'd stand with both from somebody already …

Member Avatar for Narue
0
138
Member Avatar for vddmanikanta

And what have you done to help yourself first? Your question sounds a lot like "I don't want to think, do it for me."

Member Avatar for mike_2000_17
0
170
Member Avatar for arshi9464

Interpreted code isn't necessarily executed line by line. In many cases it's compiled to an easier to run intermediate form (Java bytecode, for example). While an interpreter might be one program that reads and runs source code all at the same time, often you'll really have two programs under the …

Member Avatar for Narue
-1
109
Member Avatar for vienne

[QUOTE=vienne][B]I'm having a problem with my sorting algorithm. before I made quick sort which used insertion sort, but I don't want to use this insertion sort. I want to use recursive algorithm. Also, I want to get new idea, so If you know any quick sort algorithm, reply for me.Please~ …

Member Avatar for shashankc
0
267
Member Avatar for Annettest

[QUOTE]I don't understand what is wrong with writing code like: Wood a, b, c; (a * b) = c;[/QUOTE] There's nothing [i]wrong[/i] per se. It's generally frowned upon because when overloading operators, the general rule of thumb is "do as the ints do", or match the semantics of built-in types. …

Member Avatar for Annettest
0
220
Member Avatar for Dionysus
Member Avatar for Adak
0
730
Member Avatar for ram619

Your prototype of fun says that sum and avg are floats. Your definition says that sum and avg are pointers to float. Make up your mind.

Member Avatar for ram619
0
5K
Member Avatar for jk09

I've seen the term used in two contexts: [list=1] [*]An algorithm for an undecidable problem. In other words, there's no proof that the algorithm will reach a conclusion in finite time. [*]In reference to hypercomputation theory. [/list]

Member Avatar for Narue
0
76
Member Avatar for Hey90

[QUOTE]I do not have that error with feof[/QUOTE] That doesn't make it any less of a bug.

Member Avatar for Adak
0
257
Member Avatar for Zvjezdan23
Member Avatar for cbsinc

[QUOTE]don't want someone to do my work for me, but need direct and timely answers to questions, immediately[/QUOTE] You'll get direct and timely answers for free simply by posting your questions here. If you don't believe me, I suspect we have differing opinions on what constitutes doing your work for …

Member Avatar for Ancient Dragon
0
101
Member Avatar for prasi_raj

tmp first needs to point something: [code] user init; user *tmp = &init; [/code]

Member Avatar for Rass Saee
0
87
Member Avatar for dalymiddleboro

Your prototype and definition of do_stuff don't match. int and a reference to an int are two different types.

Member Avatar for Fbody
0
149
Member Avatar for Duki

[QUOTE]Does anyone know what this is?[/QUOTE] It's just a macro that's either blank or represents the compiler's keyword for a far pointer (à la Intel's 16-bit segmented memory model). [QUOTE]could someone explain the difference between these two lines (after the typedef executes)[/QUOTE] One is a pointer, the other is an …

Member Avatar for Ancient Dragon
0
2K
Member Avatar for arthurav

Your declaration and definition don't match. The friend declared in your class is not a template while the defined operator<< is.

Member Avatar for vijayan121
0
2K
Member Avatar for Frederick2

[QUOTE]Couldn't they have just used size_t instead?[/QUOTE] Sure, but there were two reasons to define size_type: [list=1] [*]Support custom allocators and different memory management strategies without forcing code changes. [*]Historically, size_type was added to the STL implementation to deal with a problem on the Intel architecture (no, I don't know …

Member Avatar for Frederick2
0
154
Member Avatar for AhmedGhazey

There's too much complexity involved in overloading on return type. It's simply not valuable enough to justify the cost of the feature.

Member Avatar for AhmedGhazey
0
103
Member Avatar for Duki

I don't see you terminating your string with '\0'. That's required by atoi or you'll walk right off the end.

Member Avatar for Duki
0
128
Member Avatar for Anirudh.
Member Avatar for Violet_82

All of the is* functions accept an int type, but the range must either fit into an unsigned char or equal the EOF macro. In this case, you can use cin's status to determine validity: [code] #include <iostream> #include <ios> #include <limits> int main() { int amount; while (!(std::cin>> amount)) …

Member Avatar for Violet_82
0
173
Member Avatar for Snader

[QUOTE]what will be its output:??[/QUOTE] No output. It's not C, and won't compile as C++ either due to syntax errors. But you'd know that if you tried compiling it. :icon_rolleyes:

Member Avatar for stevanity
0
88
Member Avatar for sketchiii

[QUOTE]If you were a programmer, you'd know by that logic you could also say, "I know 'Hello' in Chinese, therefore I'm fluent in it". ;P[/QUOTE] Faulty logic. He said "I'm a programmer", not anything about fluency. The argument could be made that one knows Chinese after learning one word, though …

Member Avatar for MosaicFuneral
0
391
Member Avatar for Chinjoo

Please stop posting poorly formated non-standard code for no reason at all. If you insist on spamming the forum with pointless threads, I'll delete them without hesitation.

Member Avatar for yash00yash
0
481
Member Avatar for michaelzip

If your algorithm is written to handle binary files (as opposed to text), then it really comes down to whether to file compresses well or not. Multimedia tends to be compressed already, so LZW might not yield good results.

Member Avatar for michaelzip
0
166
Member Avatar for nalasimbha

[QUOTE]Your code is almost unreadable.[/QUOTE] Are you on crack? The code is both consistent and intelligently formatted. The only truly odd thing I can see is a tab on both sides of the assignment operator, but that's hardly enough to cause one to trip up when reading.

Member Avatar for Narue
0
308
Member Avatar for p0l4rb34r

[QUOTE]I ws just wondering what kind of knowledge one would need to learn to program.[/QUOTE] You don't need any knowledge, but computer power user skills will go a long long way. If, for example, all you know how to do is send email and surf the web, you'll have a …

Member Avatar for asterix15
0
175
Member Avatar for Rass Saee

C isn't a protected environment. You can do these things, but you can't rely on the result being predictable or reproducible.

Member Avatar for asterix15
0
100
Member Avatar for bbman

[QUOTE=bbman;1445573]Thanks for your reply, i got it working.. just one more problem, i need to get the number quick.. but since the seed depends on time, if i call the function again within the same second, it gives me the same random number.. anyway to EASILY fix that? like by …

Member Avatar for Narue
0
167
Member Avatar for preetip24

Please learn to type like an intelligent human. Those stupid abbreviations don't encourage clueful people to help you, and might even turn away non-native English speakers who could have trouble even deciphering your post.

Member Avatar for Narue
-1
45

The End.