6,741 Posted Topics

Member Avatar for optimus_prime_1

[QUOTE]it is not part of the standard C++ library[/QUOTE] It's available in C++11 though.

Member Avatar for vijayan121
0
146
Member Avatar for Despairy

nameList is uninitialized. Since you're always using realloc() to allocate memory to nameList, it should be initialized to NULL for the first allocation to succeed: [code] char** nameList = NULL; [/code]

Member Avatar for Narue
0
2K
Member Avatar for thanveer11.nc

The usual methods of storing passwords aren't reversible, so the only option is resetting the password. You can then either email the new password to your users and give them the option of changing it, or invalidate the password and force them to change it rather than risk sending a …

Member Avatar for thanveer11.nc
0
83
Member Avatar for Zssffssz
Member Avatar for Zssffssz
0
438
Member Avatar for dsmey

There's a rather large difference between pointers to functions and pointers to instance member functions. The latter is actually an offset rather than a true pointer, so the two are not interchangeable. [url]http://www.parashift.com/c++-faq-lite/pointers-to-members.html[/url]

Member Avatar for Narue
0
173
Member Avatar for meli1

[QUOTE]Is it possible to do something like this with strtok()?[/QUOTE] No, strtok() doesn't support rules for embedded delimiters. What you want is more along the lines of a CSV parsing algorithm

Member Avatar for meli1
0
144
Member Avatar for PapaGeek
Member Avatar for PapaGeek
0
127
Member Avatar for lilsancho

[QUOTE]Should i create an Array of structures and copy the Information using the void Read_Info(void) function into each struct?[/QUOTE] Yep. This is fine for school assignments unless there's a specific requirement to handle huge files. It's vastly simpler to store all of the records in memory and then resort[*] as …

Member Avatar for lilsancho
0
161
Member Avatar for Radi0ShacK

>I just wanna know how to send a file through a socket connection in C language The same way you would send any other stream of characters. Just pretend the socket is an output stream and copy the file to it.

Member Avatar for MaSSaSLaYeR
0
497
Member Avatar for Hinnawi

[QUOTE]i wanna know what Mac Mini do SIMPLY[/QUOTE] It's a gimped Mac intended to fit the target market of a cheap computer with a small form factor. What does it [i]do[/i]? Everything a regular computer does, just slower. ;)

Member Avatar for NicAx64
0
325
Member Avatar for MrEARTHSHAcKER

Borland Builder has been primarily C++ (with C support) for many years. Another option is Microsoft's Visual C++ if you want a visual designer that's integrated into the IDE.

Member Avatar for MrEARTHSHAcKER
0
220
Member Avatar for coolbeanbob

Let's make it even more complicated. ;) B-Tree is an ambiguous term, and there are different versions that will wait until nodes are more full or less full before splitting.

Member Avatar for coolbeanbob
0
188
Member Avatar for zo0oda

[QUOTE=zo0oda;1690381]thanx for replay..... I know what you say because i read about linked list and i knew the basics but i'm still waitting the code from someone .....[/QUOTE] I'm interpreting this as you know how to do it, but you're too lazy to do it yourself. Thus you came here …

Member Avatar for Narue
0
115
Member Avatar for jerox

If I understand your question properly, you want to split and store strings rather than integers or single characters. While you could do it manually, that kind of ad hoc parsing is potentially tricky and more verbose than a similar solution using the standard library: [code] #include <stdio.h> #include <string.h> …

Member Avatar for jerox
0
141
Member Avatar for terence193

You only need to show the invalid prompt if the entered value was actually invalid: [code] printf("Enter a positive number: "); fflush(stdout); /* I'm ignoring non-integer input for now to keep things simple */ scanf("%d", &x); while (x <= 0) { printf("Invalid input. Please try again: "); fflush(stdout); scanf("%d", &x); …

Member Avatar for YAMNA MIDHAT
0
202
Member Avatar for pseudorandom21

[QUOTE]If you're like me and enjoy Steam's service (not having to mess with DVDs and CDs)[/QUOTE] I feel far more comfortable with media than steam. Also keep in mind that if you're playing on a PC, the modders will almost certainly offer a no-DVD patch so that the media will …

Member Avatar for frogboy77
0
182
Member Avatar for ram619

[QUOTE]please tell me whether this code is right ??????[/QUOTE] No, we've already gone over this. The author of your book is a retard, and you can't trust any of the code in it. Actually, you can trust that the code is probably wrong in all examples. I can only imagine …

Member Avatar for ram619
0
197
Member Avatar for Tylerp14

Well, if you want to follow standard Windows interface guidelines, that information would be under the [B]Help[/B] main menu option. It should display a dialog with the information. You say you're using Visual Studio 2010, but that's not enough information. Is this a C++/CLI application using Windows Forms or WPF, …

Member Avatar for Tylerp14
0
243
Member Avatar for ram619

[QUOTE]And why these address are fixed.[/QUOTE] The addresses aren't fixed, but the likelihood of the addresses being right next to each other is pretty good. Here's my output (after fixing your Turbo C crap boilerplate): [code] Address of i=28ff18 value at ptr=10 Address of j=28ff14 value at ptr=20 [/code] Notice …

Member Avatar for ram619
0
152
Member Avatar for sorrow0o

[QUOTE]What I am wondering is, if I just declare an dynamic array with the size [0], I can still write to [1] for example.[/QUOTE] Why would you be able to use more memory than you allocated? [QUOTE]What would be the proper way of creating a dynamic array that changes its …

Member Avatar for Narue
0
96
Member Avatar for fsefsef23

When people say "comparison" in the context of a sorting algorithm, they typically mean comparing the items in anticipation of a swap. In the case of selection sort, the "comparison" would be where you're looking for the largest (or smallest) unsorted item. Here: [code] if (array[j] > array[bigIndex]) // This …

Member Avatar for Narue
0
533
Member Avatar for wnr78ta

[QUOTE]What else could cause a seg fault on the last line of code no matter what that line of code is?[/QUOTE] Corrupted memory that only manifests in the destructor is a good start.

Member Avatar for wnr78ta
0
718
Member Avatar for Dakot

Well, arrays are indexed starting at 0, so if you want to map 1 to the first name, it would be [iCODE]users[index - 1][/iCODE]. Then all you need to do is ask the user to enter a number corresponding to the person they want to vote for. Your loop has …

Member Avatar for Narue
0
102
Member Avatar for tedman102

[QUOTE]How do you determine whether the input is a string, a double type or integer?[/QUOTE] The state of cin will tell you if there was an error. If you ask for an integer, for example, and the operation fails, it's fairly safe to assume that the user typed the wrong …

Member Avatar for Narue
0
266
Member Avatar for dhsn

Which three did you try? I have no problem with Microsoft, GNU, Borland, and Intel. Those are probably the top four for Windows platforms.

Member Avatar for nilay2141992
0
306
Member Avatar for kab5zb

[QUOTE]I have a text file with 10 lines, one word on each line and I am trying to get a word from a random line and then cout that word.[/QUOTE] Take note that since there's only one word on each line, the problem can be restated as trying to get …

Member Avatar for thines01
0
191
Member Avatar for maria536

[QUOTE]If I knew what to do I would not posting here.[/QUOTE] What Walt meant is that if you don't show us your updated code, it's rather difficult to help you with the changes you made.

Member Avatar for maria536
0
142
Member Avatar for infantheartlyje

Given the size difference, I'd say that your compiler implements virtual bases using a virtual base pointer (much like the better known virtual table pointer for polymorphism). Extra bookkeeping is required to maintain the shared instance, because the compiler can't simply stack the instances as in non-virtual inheritance.

Member Avatar for Narue
0
207
Member Avatar for achava

[QUOTE]Using a C but not a C++ compiler.[/QUOTE] Irrelevant. Both languages follow the same rule. [QUOTE]But I would like to know what the C standard really tells us here.[/QUOTE] The C standard says that it invokes undefined behavior. See section 6.2.2: [quote] If an object is referred to outside of …

Member Avatar for Narue
0
148
Member Avatar for usustarr

A rolling window would be the simplest solution, in my opinion, at least to get the last N lines: [code] #include <algorithm> #include <cstddef> #include <fstream> #include <iostream> #include <iterator> #include <list> #include <string> using namespace std; namespace { const size_t N_LINES = 100; } int main() { ifstream in("filename"); …

Member Avatar for usustarr
0
195
Member Avatar for skylinedrifter

[QUOTE]I will have to trust that you understand the code below or else u are just screwing yourself over.[/QUOTE] If it's really for his girlfriend then he's screwing her over...and not in a good way. [QUOTE]there is no rule saying I cannot post code as long as I wrote it …

Member Avatar for frogboy77
0
112
Member Avatar for fsefsef23

What do you mean that it makes 0 comparisons? Because compiling as-is with a simpler driver, I get reasonable comparison results.

Member Avatar for fsefsef23
0
3K
Member Avatar for swissknife007

[QUOTE]I am getting a segmentation problem in swap(a[m].a[k]); Please explain.[/QUOTE] The simplest form of debugging is debug messages: [code] k=(m+n)/2; printf("m:[%d] n:[%d]\n", m, n); swap(a[m],a[k]); [/code] Verify that your indices aren't out of bounds at any point during the algorithm, because that's the most likely cause of segmentation faults in …

Member Avatar for Adak
0
141
Member Avatar for Sadun89

[QUOTE]As I know there is no disadvantages of OOP if I am not wrong.[/QUOTE] You're wrong. Go do a google search and educate yourself.

Member Avatar for snipsala
0
332
Member Avatar for janejackson87

[B]Encapsulation[/B] can have different meanings depending on whom you ask. Most of the time you'll see encapsulation rolled up along with data hiding, which while appropriate, is technically incorrect. My interpretation of encapsulation is strictly the bundling of data and behavior. In the case of C++, those would be the …

Member Avatar for mike_2000_17
0
202
Member Avatar for louguzzo

[QUOTE]ALL arrays start at zero, or just most? [/QUOTE] It varies depending on the language you use. In pseudocode, just specify which one you want and go with it. Pseudocode is, after all, just a faux programming language that helps you think in code better than flowcharts. [QUOTE]Or do you …

Member Avatar for snipsala
0
181
Member Avatar for Arjunah

[QUOTE]although it is asking me "option-1", its skipping the "Ques-"[/QUOTE] My crystal ball says that the caller of quizquestion() is doing input using the >> operator, which leaves a newline in the stream for [iCODE]cin.getline(stmt,100)[/iCODE] to terminate on immediately. Try placing a cin.ignore() at the beginning of quizquestion(); I'm willing …

Member Avatar for Narue
0
250
Member Avatar for sasho648

By "add bytes" I assume you mean insert rather than overwrite, and the answer is no. For very large files you'd probably be better off working out a multi-file scheme where the point of insertion contains a reference to another file with the inserted data rather than the data itself.

Member Avatar for Narue
0
73
Member Avatar for janejackson87

[QUOTE]That said, Android is far less dependent on a single source for both hardware and software, so is theoretically less fragile than is iOS.[/QUOTE] Though in practice that makes it [i]more[/i] fragile. I recently bought an iphone, and the reason is because the Android devices were too risky (and my …

Member Avatar for jwenting
0
211
Member Avatar for indrajeet6

Helpful hints, hmm. How about don't be lazy? It's not like someone walked up to you on the street and gave you this assignment when you know zilch about trees. You must have learned something in class before your teacher gave the assignment, so posting up the requirements without trying …

Member Avatar for suyash_iiit
0
207
Member Avatar for MachDelta

[QUOTE=MachDelta;1686106]Another newbie question here. What's the difference between these two? [CODE]cin.ignore(cin.rdbuf()->in_avail(), '\n'); cin.ignore(numeric_limits<streamsize>::max(), '\n');[/CODE] I understand that the former will ignore only the characters [I]left[/I] in the stream buffer, while the latter tries to ignore characters equal to the [I]size[/I] of the buffer. So the end result should, normally, be …

Member Avatar for MachDelta
0
132
Member Avatar for marco1497

Your question is confusing and suggests a misunderstanding about compilation. A programming language is the (usually textual) manifestation of a set of rules for specifying instructions to the computer. Because those rules are designed for human programmers, they're abstracted to a higher level and need to be converted into something …

Member Avatar for JeffGrigg
0
257
Member Avatar for s_h_a_m

That's not a typical pyramid pattern for beginners. Can you provide a larger example? 10 rows, perhaps?

Member Avatar for timetraveller92
0
95
Member Avatar for phr33k

[QUOTE]Sorts the values in ascending order according to the following algorithm, where size is the number of doubles to be sorted: for i=0..size-2 check all the values between position i and size-1 to find the smallest one swap the smallest value and the one in position i[/QUOTE] That's a description …

Member Avatar for dctb13
0
328
Member Avatar for Zssffssz

[QUOTE]I noticed that, getting user imput, conditional statements, using escape charecters, exicuting system commands, and even declaring variables and using them so that they have use; these are all difficult outside of the domain of C and C++[/QUOTE] Hahaha! No. ;) [QUOTE]even the merciless Java can't do it without several …

Member Avatar for xfbs
0
243
Member Avatar for tquiva

[B]>But perhaps there might be an easier way to do this?[/B] Well, if you don't want to do the if statement route (probably best in this case), you could go overkill and use qsort... [code] #include <stdio.h> #include <stdlib.h> int compare(const void *a, const void *b) { const float *ia …

Member Avatar for larsake27
0
748
Member Avatar for str91

[QUOTE]In programming it's "Study & plan, then you can"**.[/QUOTE] That sounds goofy. How about "Get your shit together at design time rather than coding time". :D

Member Avatar for Adak
0
92
Member Avatar for hari.paartha

Google for a C++ Excel library. Alternatively you can use an OLE library to interface with Excel files, but either way you're looking at a third party library to do the heavy lifting.

Member Avatar for Narue
0
495
Member Avatar for mosesaaron

It really depends on how thorough you want to be, but I've found that the following triple whammy is sufficient most of the time: [list=1] [*]Make sure that your images are registered so that you can identify yourself as the copyright owner in the case that someone steals them. [*]Decrease …

Member Avatar for mark santa
0
153
Member Avatar for ag_17

It's certainly confusing, but straightforward once the concept is understood. Formatted input methods ignore leading whitespace. Unformatted input methods don't ignore leading whitespace. The newline character is whitespace. Finally, getline() terminates when it detects a newline. So the pattern where getline() is "skipped" would be formatted input followed by getline(), …

Member Avatar for Narue
0
174

The End.