6,741 Posted Topics

Member Avatar for arcticM
Member Avatar for john butler

[B]>Basically what is the system level difference between language C and C++ ?[/B] There are probably more systems with a C implementation than a C++ implementation, but aside from that the difference is nil. [B]>well the main difference is that c is a procedural >language while c++ is an object …

Member Avatar for Narue
0
159
Member Avatar for لولوة

[code] class Example { int x; }; [/code] Example::x is a private data member. This means that only friends and the Example class itself can access it. This is good practice, data members should be private. But let's say you still want to give users of the class restricted access. …

Member Avatar for Dave Sinkula
0
213
Member Avatar for gerard4143

[B]>Can you predict what the answer will be?[/B] I can certainly try. [B]>Now run it, were you right?[/B] Yup.

Member Avatar for gerard4143
0
142
Member Avatar for kc0arf

Somen noodles, the easiest breakfast you'll ever cook. 1 bundle of somen 6 cups of water 1 tablespoon of salt Boil the water, pour in the salt, toss in the somen, cook on medium heat for 3 minutes. It's good plain or with all manner of sauces and garnish. :)

Member Avatar for pogson
0
2K
Member Avatar for Geek-Master

>Then what is the point to use pointer and new operator to declare the array in the first case? Because the second case is ill-formed and thus, illegal in C++. Array sizes in C++ must be [B]constant[/B] integral values. If it works when you try it then that's because your …

Member Avatar for new programer
0
490
Member Avatar for lisedaton

I suspect you're compiling your C code as C++. That's not recommended unless you really know what you're doing. Anyway: [B]>#include <malloc.h>[/B] <malloc.h> is archaic and non-standard. Use <stdlib.h> instead. [code] /* Wrong */ struct strs { char x; }; typedef struct str strs; [/code] Notice that your typedef is …

Member Avatar for Narue
0
133
Member Avatar for daudiam

[B]>So in essence, what is undefined in the Standard becomes >defined in the context of a particular compiler.[/B] That rather goes without saying, but doesn't change anything. The result can still be unpredictable, and it's certainly not portable. [B]>Doesn't it blur the difference between the two things, >when the implementation …

Member Avatar for Narue
0
169
Member Avatar for daudiam
Member Avatar for xzero_x

[B]>who can answer thi question??[/B] You can. We can too, but [I]won't[/I], because we don't help students cheat on their homework.

Member Avatar for SgtMe
0
320
Member Avatar for daudiam

[B]>I know that ++a is faster than a++ because a++ has to first store >the previous value of a at some temporary location and then >increment a and then return the saved value, whereas ++a simply >increments a and returns the pointer to the incremented value.[/B] That's a reasonable analysis, …

Member Avatar for nezachem
0
637
Member Avatar for Excizted

[B]>I'm wondering if I'm duplicating this class by doing the following.[/B] I'm not sure what you mean by "duplicating this class". [ICODE]point[/ICODE] will point to an object that's copy constructed using sc as the argument. Whether that's a good thing or not depends on how SimpleExample is implemented. It could …

Member Avatar for mrnutty
0
96
Member Avatar for shock1

shock1, any book on C++ will answer these questions for you. Please don't spam the board before searching for your own answers.

Member Avatar for Narue
0
340
Member Avatar for kwixbit

Assuming you can't just allocate the whole thing after getting the rows, it looks like you're on the same track for what I would consider doing. I'd create an array of three dynamic arrays at compile time, then allocate memory accordingly and use the array as if the rows were …

Member Avatar for Narue
0
169
Member Avatar for Iam3R

[B]>please suggest me a way to solve this problem[/B] It's easy to break the world down into comments, identifiers (which includes keywords), operators, and literals. From there you can simply check for existence in your keyword and operator lists to find matches. A C compiler will use a greedy tokenizing …

Member Avatar for Narue
0
83
Member Avatar for Iam3R

[B]>can i use undef for a function like - macro, by just specifying the >name of the macro with out specifying the argument list as written in line 8.[/B] Yes, though not exactly like line 8 because preprocessor directives don't end with a semicolon. To answer your specific "doubt", the …

Member Avatar for Narue
0
111
Member Avatar for maqsood8797

The program requirements say all that needs to be said: [quote] Please solve it on your own/submit your own solution. [/quote] We don't help cheaters cheat.

Member Avatar for ShortYute
-4
153
Member Avatar for ShortYute

Think of console input as a two tier operation. At the top level is the shell (the console itself), which talks to the keyboard driver and buffers characters typed by the user. When the user signals the end of input (usually in the form of a newline), the shell stops …

Member Avatar for ShortYute
0
358
Member Avatar for sknake

[B]>Well then be more vocal about which features you use and how you use them.[/B] Do you want a weekly status report about how we use the site? When you change things in a seemingly arbitrary way without asking for specific feedback from us, it's hard to give you the …

Member Avatar for sknake
2
431
Member Avatar for tkud

[B]>Is saving my files as .cpp the problem?[/B] If you're trying to compile C as C++ then yes, that could be a problem. There are subtle differences between the two languages such that the C subset of C++ and actual C aren't perfect matches. In your project properties->configuration properties->C/C++->Advanced, you …

Member Avatar for Frederick2
0
314
Member Avatar for Iam3R

[B]>why sizeof does not consider name of the array >as some address and give pointer size bytes.[/B] Because the conversion from array to pointer only occurs in a value context. The operand of sizeof is being used in an object context, so the conversion doesn't happen. There are three object …

Member Avatar for Narue
0
104
Member Avatar for mahela007

[B]>What does BIOS do on modern PCs after the operating system is loaded and running?[/B] A whole lot of nothing. The whole point of the BIOS is to put the system into a state where the OS can be loaded. After the OS is loaded, it takes over control of …

Member Avatar for mahela007
0
81
Member Avatar for mrnutty

[B]>Sorry for the unclarity[/B] Here's a brute force example program that does what I think you're asking for. It might help the requirements become more clear for the participants (assuming I understand them ;)): [code] #include <functional> #include <iostream> #include <numeric> #include <string> #include <vector> class listall { const std::vector<int>& …

Member Avatar for mrnutty
0
148
Member Avatar for Waylon

[B]>Any suggestions?[/B] Sure. Change [ICODE]getMap(&map)[/ICODE] to [ICODE]getMap(map)[/ICODE]. You're adding an unnecessary level of indirection, and the compiler doesn't like it. p.s. For the record, [ICODE]while(!myfile.eof())[/ICODE] is a bad idea. [URL="http://www.gidnetwork.com/b-58.html"]This[/URL] describes the equivalent problem in C.

Member Avatar for Lerner
0
106
Member Avatar for diafol

[B]>Are you saying the other 85% should be on my hit list?[/B] [sarcasm] Of course not. That's silly. You should put everyone who doesn't bow down and kiss your feet on the [I]ignore list[/I]! Stupid retarded pleebs who don't know their place deserve it. I mean really, don't they realize …

Member Avatar for diafol
0
194
Member Avatar for Excizted

[B]>superclass (or parent class if you will) >subclass (or child class if you will)[/B] It's generally better to use the established terminology rather than equivalent terminology from another language. The C++ standard uses "base" for superclass and "derived" for subclass. Superclass and subclass have traditionally been very confusing, though I'll …

Member Avatar for Excizted
0
164
Member Avatar for mahela007

[B]>But is it worthwhile learning C if I already know python?[/B] Personally I think everyone can benefit from learning C, but your question suggests that you don't see any point in it. If you're a hobbyist, don't force yourself to learn something you don't really want to.

Member Avatar for Narue
0
138
Member Avatar for Alex_

[B]>Yep, It worked. No syntax errors.[/B] You'll find that people are more effective at helping you if you don't lie to them: [quote] [B]You[/B]: Here's my code, it compiles but gives me a warning "[I]<blah blah>[/I]". [B]Us[/B]: That's funny, because the code you posted isn't and never has been legal …

Member Avatar for Narue
0
113
Member Avatar for littledani

[B]>whch progrms u need???????? [/B] If you do this guy's homework for him, I'll be most displeased. :@ [B]>our teacher just gave us two days...[/B] Which is plenty of time. Stop acting like a loser and do your own damn work. We'll help you if you have specific questions, but …

Member Avatar for rafaqat hassan
-9
111
Member Avatar for spitfire

Don't use preprocessor macros unless you know how the preprocessor works. It's all to easy to forget that it's [b]textual replacement before anything else[/b]. So this: [code] #define SIZE 9 BTREE makeTree(int a[], int i, int SIZE); [/code] Becomes this: [code] #define SIZE 9 BTREE makeTree(int a[], int i, int …

Member Avatar for wish_C
0
593
Member Avatar for johndoe444

[B]>What is the significance of the following format specifiers:[/B] Relatively low, but they come in handy occasionally.

Member Avatar for WaltP
0
161
Member Avatar for soley

[B]>I'm already taking an intro to C class[/B] Very cool. I'm a big proponent of learning C well, even if you never plan on using it. [B]>is it wise to take these two classes at the same time? [/B] It's extremely unlikely that the C++ course will be taught "properly", …

Member Avatar for Wards
0
112
Member Avatar for StaticX

[B]>is this possible?[/B] Is this a troll? Or a bad joke? Of course it's possible, as are most things that noobs use the "is it possible?" question to ask about.

Member Avatar for necrolin
0
105
Member Avatar for attias

[B]>what is the complexity of searching an item in hashtable in average case performance[/B] Amortized O(1). While an individual search might be more expensive, in toto the performance is constant. This is all assuming the hash table is properly implemented, of course.

Member Avatar for jk451
0
114
Member Avatar for enterhellozia

[B]>How would you do that ?[/B] Look up template specialization. You write a generic template that handles the majority of types, then specialize on the ones that don't support the same operations. In your example, the template for C-style strings would be a specialization because C-style strings have different semantics …

Member Avatar for Narue
0
134
Member Avatar for hao90

[B]>I am learning the OOP recently and i have a few questions to ask[/B] I wouldn't list operator overloading or templates as features of OOP. In fact, templates are how C++ supports a somewhat different paradigm from OOP: generic programming. [B]>1) When should i use operator overloading? >2) When should …

Member Avatar for jbennet
0
106
Member Avatar for nedsnurb

[B]>goto /*line*/ 18;[/B] goto is restricted to a single function, you can't jump between functions with it. [B]>conio.h is an older c header file and is deprecated in C++...[/B] Please don't use deprecated to mean anything except "standard, but not recommended because it might not be standard in the next …

Member Avatar for bilalislamabad
0
225
Member Avatar for vibe0405

>but i tried it on the postal code anyways. it still skips it You fixed the wrong problem. Here, watch: [code] [COLOR="red"]You're typing a last name, say "smith". But you finish by hitting the Enter key. Thus the string is really "smith\n". scanf doesn't read the '\n', so it stays …

Member Avatar for cthoes
0
2K
Member Avatar for johndoe444

The header contains declarations and is included in multiple places because declarations can be duplicated. Then you have one implementation file that has the definitions: [code] /* globals.h */ extern int glob; extern int foo ( void ); [/code] [code] /* globals.c */ #include "globals.h" int glob = 0; int …

Member Avatar for johndoe444
0
172
Member Avatar for saintrenz

[B]>there some that dont have answer which you know please do tell..[/B] No. We'll tell you if your answers are correct or not, but we're not doing your homework for you. [B]>Write a brief answer to the following items. [/B] No. [i]You[/i] write a brief answer and we'll tell you …

Member Avatar for ryoumah03
0
204
Member Avatar for mindfreaks2000

[B]>If u r programming in visual studio c++[/B] I'm not programming in Visual C++ right now, so I guess I won't share my code with you. :icon_rolleyes: [B]>I WILL ALSO SHARE MINE.[/B] Quite frankly, I'm not sure your code will be worth reading. But I can't verify that because I …

Member Avatar for cwarn23
-7
173
Member Avatar for Thumb2

[B]>Why is this producing an error?[/B] Stream objects aren't copyable at the object level. As jonsca said, you need to pass a reference to the ifstream.

Member Avatar for jonsca
0
146
Member Avatar for evilsweeps

item and rtItem aren't nodes, they're the actual keys. You compare them like so: [code] if ( item == rtItem ) [/code] Your algorithm, however, is broken. It won't set equal to the correct value in all cases because you reset it to true. You need to consider more cases …

Member Avatar for evilsweeps
0
272
Member Avatar for qwertymk

[B]>I know I'm supposed to use new and delete, but I really need to use realloc[/B] malloc/calloc, realloc, and free don't fit well at all with objects of a class type. You really should forget they exist unless you [i]really[/i] know what you're doing. Fortunately, realloc can be simulated in …

Member Avatar for Narue
0
147
Member Avatar for HITMANOF44th

Check the class of whatever aPort is to see if it has a non-blocking read, or some way to query the port for incoming data. If not, you might want to look into spawning a separate process or thread for inputting data. At least that way the whole program won't …

Member Avatar for HITMANOF44th
0
102
Member Avatar for Iam3R

All you're doing with the divide and conquer is breaking up the list into smaller lists, then putting the sorted smaller lists back together. This breakdown and rebuilding is an O(logn) operation: [code=text] 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 …

Member Avatar for Narue
0
127
Member Avatar for Instinctlol

[B]>In most, if not all OSes; if a program's main function returns an int, 0 >indicates that program execution ended normally. >Any other value indicates that the program execution ended >abnormally. In other words an error occurred.[/B] That's required behavior for a C++ implementation. It has nothing to do with …

Member Avatar for Narue
0
116
Member Avatar for nschessnerd

[B]>I tried using delete[/B] That only marks the object as ready for garbage collection. It doesn't actually release anything until the garbage collector runs on the same generation. Even when the garbage collector runs, that doesn't mean your process' footprint will go down. The memory might remain allocated for faster …

Member Avatar for Narue
0
138
Member Avatar for ax8l

C doesn't support function overloading, but because an added dimension or level of indirection constitutes a different type, you can do what you want in C++ (more or less).

Member Avatar for ax8l
0
102
Member Avatar for darkunknown

The time function comes from the <ctime> header (failure to include it is probably your error), and keep in mind that everything in the c* headers should be in the std namespace: [code] #include <cstdlib> #include <ctime> int main() { std::srand ( (unsigned)std::time ( 0 ) ); } [/code] Though …

Member Avatar for darkunknown
0
153

The End.