6,741 Posted Topics

Member Avatar for JoBe

>there's no way to either go to the top of the page The Home key on my keyboard is sufficient for that task.

Member Avatar for JoBe
0
59
Member Avatar for CPPRULZ

>I declare a pointer ptr (int *ptr; ) and then define ptr >as 5 by saying *ptr=5; what adress is ptr pointing at The precise answer depends on where you've declared the pointer, but the short answer is "nowhere you can dereference". Therefore your code exhibits undefined behavior. A pointer …

Member Avatar for JoBe
0
130
Member Avatar for dc87

Stop attaching short programs, please. It's better to embed the code in your post when you can and attach only when the code is far too long to be put in a post.

Member Avatar for Aia
0
343
Member Avatar for firoz.raj
Member Avatar for vaibhour

*Puts on old school Narue hat* >Can ne1 help No, you're beyond help. If you had done even a simple search, you would have found approximately a metric shitload of posts asking exactly the same question and getting a complete answer for any variation of cluelessness you might be able …

Member Avatar for vikas1
0
117
Member Avatar for CPPRULZ

You need to define num as well as declare it: [code=cplusplus] class number{ private: static int num; public: int getnum() {return num;} void setnum(int innum) {num=innum;} }; int number::num; [/code]

Member Avatar for grumpier
0
157
Member Avatar for bugmenot

>_TCHAR* tmp = new _TCHAR( i+1 ); This looks like a bug to me. You want to simulate a dynamic array, but you're using the wrong syntax: [code=cplusplus] _TCHAR* tmp = new _TCHAR[i + 1]; [/code]

Member Avatar for bugmenot
0
381
Member Avatar for Manutebecker

>vectors are like the peanut butter to my chocolate! Which suggests that you go out of your way to use vectors even when they're not the best solution. Next!

Member Avatar for Manutebecker
0
129
Member Avatar for ecentric

>i am unsure how to find words only starting with f and replacing the string. You might find it easier to work through the source string character by character. This is really the realm of regular expressions, but an algorithm for matching the first character of each word isn't difficult: …

Member Avatar for ArkM
0
2K
Member Avatar for crioto

>But how to do it? Did you not read the answers you've been given? Both of them told you to use the strstr function.

Member Avatar for ajay.krish123
0
87
Member Avatar for Creator07

More code please. Preferably a complete program that exhibits the problem so we can play with it.

Member Avatar for Creator07
0
185
Member Avatar for shankhs

Perhaps you should try to learn about trees in general. Most people start with [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]linked lists[/URL] to get a feel for how linked data structures work, then they move on to [URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_bst1.aspx"]binary search trees[/URL], and then to graphs. Generally if you understand binary search trees, it's not a great leap …

Member Avatar for shankhs
0
99
Member Avatar for Ragupathiyuva

>argv is the argument vector >argc is the number of arguments Note that argc and argv are simply conventional names. You can change them. In fact, I see av and ac quite a bit as alternate names. >Argument vector is an array of pointers to strings. It's an array of …

Member Avatar for Narue
0
387
Member Avatar for rad!anc3

>for (o=n; o>0; o--) Each row of the second triangle is based on n, and n doesn't change throughout your program. I believe you want to set o to m instead.

Member Avatar for rad!anc3
0
177
Member Avatar for serkan sendur

There's a sticky [URL="http://www.daniweb.com/forums/thread90228.html"]How do I flush the input stream?[/URL] that explains your problem and provides several solutions. Thanks for searching before posting...not! :icon_rolleyes:

Member Avatar for serkan sendur
0
2K
Member Avatar for Lukezzz
Member Avatar for lara_
Member Avatar for serkan sendur

>how did the linker or compiler find the path to that IO library when all i do is only header inclusion? Compiling and linking are two separate stages. The header is [I]only[/I] relevant during compilation because declarations for the names you use must be present before you use them or …

Member Avatar for Narue
0
109
Member Avatar for tgreiner

Both functions are broken in quite a few ways >const comma=','; C++ doesn't support implicit int. >char *accum=""; There are two serious problems here. First, you're not allowed to modify the contents of a string literal, but that's precisely what you're trying to do. Second, a pointer doesn't imply infinite …

Member Avatar for Narue
0
144
Member Avatar for suley04

In my experience you save yourself a lot of headaches by avoiding both sharing (working with the same file through two streams simultaneously) and read-write access (being able to read from and write to the file through a single stream).

Member Avatar for suley04
0
109
Member Avatar for serkan sendur

>how it is logical to get this to work? C++ takes an expression and evaluates it in a boolean context, but the expression itself doesn't have to evaluate to the bool type. [ICODE]a = 0[/ICODE] evaluates to the value of a, which is 0, which when treated in a boolean …

Member Avatar for Narue
0
117
Member Avatar for stindeee

Be more specific please. I have a vague idea of what you're asking only because I've answered the diamond question several hundred times already.

Member Avatar for Lerner
0
91
Member Avatar for suley04

>it doesn't stop on 13 Clearly not, because you don't tell it to stop when the user enters "13". Both loops run exactly 13 times, and they'll do this without fail unless you break from the loop: [code=c] for ( i = 0; i < 13; i++ ) { /* …

Member Avatar for suley04
0
102
Member Avatar for tomtetlaw

>A much clearer method would be rand()%x , where x is the number you want. Clearer, but not necessarily better. rand has subtleties that need to be considered. In particular, there are two distinct problems with rand: one historical and one that is still common. The historical problem is that …

Member Avatar for Narue
0
318
Member Avatar for arnaudrizzo
Member Avatar for Ragupathiyuva

>What is the usage of Static functions and where we can use static functions have a visibility restricted to the translation unit in which they're declared. You can use them anywhere a regular function can be used, but you [i]should[/i] use them everywhere you can because they follow the rule …

Member Avatar for Ragupathiyuva
0
102
Member Avatar for mrinal.s2008

>vector<T> :: iterator ptr; Change this to: [code=cplusplus] typename vector<T> :: iterator ptr; [/code] Dependent types need explicit qualification with typename because C++ assumes they're not types and they can't be used in a declaration.

Member Avatar for mrinal.s2008
0
211
Member Avatar for nida afaq

The entered character is always of a char type. Presumably what you want is to see if that char represents a digit: [code=cplusplus] #include <cctype> #include <iostream> int main() { char ch; while ( std::cin.get ( ch ) ) std::cout<< std::boolalpha << (bool)std::isdigit ( ch ) <<'\n'; } [/code]

Member Avatar for Narue
0
112
Member Avatar for nitro

>but this is just one node No, it's just the definition of a node. You don't actually have any yet. >please tell me how i can code a BST in c++ ? [url=http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_bst1.aspx]This[/url] is in C, but you look like you're at the point where it doesn't matter, because you …

Member Avatar for AHUazhu
1
144
Member Avatar for Titanius

I think it's easier to use an array instead of a switch: [code=cplusplus] int days_in_month ( int month, int year ) { int month_days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int days = month_days[month - 1]; if ( month == 2 && is_leap …

Member Avatar for Titanius
0
175
Member Avatar for cusado

Be more specific. Formatted text with fprintf is right aligned by default, so clearly you want to do something other than that.

Member Avatar for Narue
0
252
Member Avatar for Yaserk88

You're in luck. If you don't initialize all of the items in your array in the initialization list, the ones you didn't specify will be set to the equivalent of 0 for that type: [code=cplusplus] double U[N]={0}; // Completely filled with 0 double g[N][M]={0}; // Completely filled with 0 [/code]

Member Avatar for Yaserk88
0
96
Member Avatar for Frederick2

>template<class Tpl, unsigned int iSize> >void AddData(CClient& c, CArray<Tpl,MAX_SIZE>& ar) Change MAX_SIZE to iSize. Since you didn't have iSize anywhere in the parameter list or as an explicit list in the instantiation, your compiler couldn't figure out what it was supposed to be.

Member Avatar for Frederick2
0
3K
Member Avatar for brianlesays

Post your code. This is an exam, not just homework, so we're going to be even more anal than usual about [I]you[/I] doing the work.

Member Avatar for verruckt24
0
124
Member Avatar for kevintse

Start by including the <string> header, which you failed to do. Also note that NULL isn't a compatible type with std::string; your stack class makes unwarranted assumptions about the type of T. Instead of NULL, you can generally use T() safely as a default value, though it's usually a better …

Member Avatar for kevintse
0
139
Member Avatar for the reaper

>and regardless of user admin guest or normal user... This is a suspicious clause. A benign program would be comfortable simply accepting expected restrictions for installation tasks that require elevated privileges. Presumably you know how to set your program as one of the startup applications when those restrictions are in …

Member Avatar for jbennet
0
315
Member Avatar for callprem26

>1. In C++, how can we print "Hello World" say 100 times witout >using any loops (for, while/do while, for_each or recursion)? You can't. Sorry. Often questions like this (given out by clueless teachers) have a loophole in the wording where you can use recursion or an unconventional loop with …

Member Avatar for Narue
0
179
Member Avatar for antonis233
Member Avatar for freelancelote

>string a; This is an empty string. >a[i]= tmp; a[i] doesn't exist. a is still an empty string. The subscript operator does not change the size of a collection.

Member Avatar for Narue
0
149
Member Avatar for lmastex

>Hey guys. Just a question. >Is it possible to [...] The answer to any "Is it possible?" question is invariably "Yes!". Further, many of these questions can be answered with simple experimentation. So are you just lazy or what?

Member Avatar for Freaky_Chris
0
106
Member Avatar for freelancelote

You can't copy an istream object, pass a reference instead: [code=cplusplus] int wCount(ifstream& myFile); [/code]

Member Avatar for Freaky_Chris
0
216
Member Avatar for singhraghav

>i wouldbe greatful if somebody could give me a solution to this... We don't give freebies, but I'll point you in the right direction: [code=cplusplus] #include <cctype> #include <iostream> #include <string> int main() { std::string line; std::cout<<"Enter your a line of text: "; if ( getline ( std::cin, line ) …

Member Avatar for unbeatable0
0
291
Member Avatar for serkan sendur

It's generally considered impolite to throw around non-universal acronyms without defining them.

Member Avatar for serkan sendur
0
78
Member Avatar for cpeeyush1
Member Avatar for William Hemsworth
0
94
Member Avatar for k33l

>quickSort(befList, needSwap(*itr,*itr2)); >quickSort(aftList, needSwap(*itr3,*itr)); You're not supposed to call needSwap here, just pass the pointer as you did in main: [code=cplusplus] quickSort(befList, needSwap); quickSort(aftList, needSwap); [/code] >But I can't figure out exactly how I'm supposed to call it. When you actually need to call needSwap, you can do so in …

Member Avatar for Narue
0
687
Member Avatar for freelancelote

>I can cout the string literal by just stating the >name of the object or I can use the data function. Yes to the first part, no to the second. You can "cout the string" by passing just the string object, but it's not safe using the data member function …

Member Avatar for Narue
0
104
Member Avatar for mybluehair
Member Avatar for dmanw100
0
83
Member Avatar for keyser_soze

>hoping someone can throw more light into this It's quite simple on the surface. Your code is broken. ;) The long answer is that there's no intervening sequence point between the evaluation of function arguments, so you're invoking undefined behavior by modifying x multiple times between sequence points. Both of …

Member Avatar for keyser_soze
0
150
Member Avatar for GrahamShaw2008

If you don't mean the logical OR operator in C, example follows, then you need to be more specific about what exactly you want to do. [code=c] #include <stdio.h> int main ( void ) { if ( 0 || 1 ) /* || is the logical OR operator */ puts …

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

>Anyone considerinstalling Vista -- don't. You will have nothing but headaches. I've only had one problem with Vista, and it wasn't caused by Vista. But I fixed that particular issue (with my graphics card driver) and now everything is just peachy. >I say try it out first, off a friend …

Member Avatar for Jen0608
3
400

The End.