518 Posted Topics

Member Avatar for catchmrbharath

Its a project-euler.net problem No. 67 Right? >My program for this program is not working >can you please help. Perhaps not. Seriously, I don't have enough time to spend and debug your code but I do can help you by guiding you to a correct algorithm: Go the the second …

Member Avatar for siddhant3s
0
261
Member Avatar for chathu12

>You return a variable that ceases to exist after the function all (a >variable local to the called function). Generally speaking, pass a >pointer (to the start of the array) and then modify it in the called >function. Exactly. I know some other person could have given advice to return …

Member Avatar for yellowSnow
0
103
Member Avatar for kelvinnvl

Re-factor the simplify function which finally converts a/-b to -a/b. This will maintain uniformity and thus the program will be unambiguous.

Member Avatar for siddhant3s
0
170
Member Avatar for yun

>>write a recursive function to convert integer into string. Your function will work good for all positive integer but would fail when N=0. IntToString(0)=""

Member Avatar for yun
0
211
Member Avatar for qwuirks

>i'm a noob in C++ can any kind soul please help me Not until you show any efforts. Sorry. Time out. Best next article for you: [url]http://www.daniweb.com/forums/announcement8-2.html[/url]

Member Avatar for siddhant3s
0
84
Member Avatar for muzhe

Oh jazzman please. Stop posting rusted C++ code. Read this [url]http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html[/url] to migrate to standard C++

Member Avatar for Ancient Dragon
0
813
Member Avatar for 4101

>it's me 4101 Oh yeah! Even my real name is 312515473215781215487451 but I let them call me Siddhant so that they remember me.

Member Avatar for siddhant3s
0
95
Member Avatar for sdmahapatra

You really need to go down to the basics of inheritance - why we use it. When you construct a base class, it is not really a base class but it is 'just a class'. It is [I]when[/I] you use that class to derive a child class, the former becomes …

Member Avatar for Laiq Ahmed
0
226
Member Avatar for sriramaam

Did you ever thought of doing your work yourself? Simply stating "I want this" do not work. At least put an effort and then ask for help. Read [url]http://www.daniweb.com/forums/thread202628.html[/url] or[URL="http://www.catb.org/~esr/faqs/smart-questions.html"] this[/URL]. Hint: use recursive functions.

Member Avatar for sriramaam
0
136
Member Avatar for scru

There you go. You have finally done it. And all these ^^ don't know about the conspiracy about making some crazy thread. Oops......... Yeah sure, void main is my favorite too. ^H^H^H^H^H^H^H^H^H

Member Avatar for ~s.o.s~
1
527
Member Avatar for gretty

>Any advice how to put each line in its own array element? Not really but it would be better to apply brains and re-factor the code provided by twomers. Declare an array of N std::strings and then iterate with a forloop to read one line by one with help of …

Member Avatar for iamthwee
0
384
Member Avatar for Azurea

Well, another "criticize my code" question. Good. Here are my advices: [LIST] [*]Try not to implement the code which has been provided to you by the standard library. This way you will make shorter and elegant code. [*]Avoid magic number: [ICODE]stCOMMA_LOC + 2[/ICODE] ,[ICODE]stCOMMA_LOC && nCounter < 7[/ICODE]. Rather, put …

Member Avatar for siddhant3s
0
140
Member Avatar for barige rajesh

>Even the delete operator is executed, the last two output statements are working >same the first two output statements. This is implementation specific. On my implementation the two outputs are different: [code]siddhant3s@Xion:~$ g++ tester.cpp -otester.exe &&./tester.exe p's add is 0x804a008 value in p is100 p's add is 0x804a008 value in …

Member Avatar for barige rajesh
0
229
Member Avatar for BattlingMaxo

Google [URL="http://lmgtfy.com/?q=OpenGL+Tutorials"]Knows[/URL]

Member Avatar for BattlingMaxo
0
126
Member Avatar for crh0872

Read this post : [url]http://www.daniweb.com/forums/post873624.html#post873624[/url]

Member Avatar for crh0872
0
131
Member Avatar for dchunt

>If the size is determined at runtime you need a full fleged dynamic memory >version. Something like A full fledged dynamic memory version? Is that what you call your program you just posted. It would be so much better to rely on the standard headers than your memory leaking program. …

Member Avatar for Tom Gunn
0
153
Member Avatar for sravan953

Don't keep bumping on your thread. No one is free enough to help you if you don't show effort. I have see many thread started by you stating "How do I do this" without any efforts. Learn to ask question the smart way : Read this page [url]http://www.catb.org/~esr/faqs/smart-questions.html[/url] Also, read …

Member Avatar for zachabesh
0
277
Member Avatar for tomtetlaw

>I want the vector to be of type 'this' What do you mean by 'this'? Do you want a vector of [I]pointer to the[/I] same class you are in. Or Do you want a vector of the same class you are in. If you wan't the former one, look at …

Member Avatar for jencas
0
231
Member Avatar for abby2589
Re: OOP

Even the use of standard C++ ( with int main, standard headers) would be nice. Read [url]http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html[/url] sections 2.1, 2.2 and 2.3

Member Avatar for Lerner
0
105
Member Avatar for AngelG

Learn a GUI library. wxWidgets is a good one :[url]http://zetcode.com/tutorials/wxwidgetstutorial/[/url]

Member Avatar for AngelG
0
81
Member Avatar for urbancalli

>These can be fun to build! Start simply two operands, one operator! then work up! Definitely not!! If you are building it for educational purposes fine; otherwise it is not recommended to hand code a lexer[1] yourself. To OP: If you 'project' is whole about building a lexer, the above …

Member Avatar for siddhant3s
0
184
Member Avatar for nanchuangyeyu
Member Avatar for NathanOliver

I remember me facing the same problem a year ago. I used the following hack rather than calling on [URL="www.boost.org/doc/libs/release/libs/serialization/"]boosts serialization [/URL]: Lets say we have a string [B]sring_to_be_written[/B] which I want to serialize: 1. I first write down the s.size() using fstream::write(): [code=cpp] size_t size=string_to_be_written.capacity()+1; ofile.write(reinterpret_cast<char *>(&size),sizeof(size));[/code] 2.Next I …

Member Avatar for NathanOliver
0
387
Member Avatar for Cloneminds

@Dave I too was thinking about this catch; later only I read your post. The solution would be this: [code=cpp] do std::cout << "Enter a number: "; while( std::cin >> tmp && tmp != -1 && (1 || (sum += tmp)) );[/code] but as you said, neither me is a …

Member Avatar for siddhant3s
0
122
Member Avatar for nanchuangyeyu

[url]http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.16[/url] Read from 16.16 to 16.19 and then try to implement the `features' of what you are talking about. If in trouble, ask the specific question.

Member Avatar for siddhant3s
0
110
Member Avatar for Ather14

What a pity, you are still struck at a 18 year old compiler. Read[URL="http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html"] this[/URL] to migrate to a better compiler. Sorry, But I am on a social movement about "anti old compilers" so I won't/can't help you.

Member Avatar for Ancient Dragon
0
977
Member Avatar for nirav99

Everything is fine except that both of you missed an important point: [B]private members are not inherited.[/B] And if you know or not, the default access code of a class is private. Hence the [I]int a,b,c;[/I] in post#1 and the [I]void SayHello()[/I] in post#2 are declared as private. They cannot …

Member Avatar for Tom Gunn
0
147
Member Avatar for csayantan

Understand what exactly #include<header.h> does: It simply copy-paste the content of header.txt and replaces it with the line containing #include<header.h> Say, if you have a header.h with the following : [code]+--header.h---------------------------------+ +-------------------------------------------+ | Sticks and Stones can break my bones. | | But they can't break my soul. | |___________________________________________|[/code] …

Member Avatar for Tom Gunn
0
189
Member Avatar for chrishtones

>Well, you could try using the derived maths functions: Why would he when he already have asin and acos? Besides why did you complicated the formula for acos(x) which is simply: [tex]acos(x) = \frac{\pi}{2}-asin(x)[/tex]

Member Avatar for tux4life
-1
184
Member Avatar for lakshay

Read [URL="http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html"]this[/URL] if you are using a crap like Turbo C.

Member Avatar for shadwickman
0
91
Member Avatar for catchmrbharath

BTW, 100! is [CODE]93326215443944152681699238856266700490715968264381621468592963 89521759999322991560894146397615651828625369792082722375825118 5210916864000000000000000000000000[/CODE] There is no fundamental integral datatype in C++ which can store this. @Vernon Good catch.

Member Avatar for siddhant3s
0
102
Member Avatar for Zetlin

file.write() methods write unformatted characters to the file. That is, it do not work like a print statement. When you issue a print statement, a new line is automatically appended. This is not the case with write(). write() performs as-is writing. You could redirect your stdout to a file and …

Member Avatar for Zetlin
0
249
Member Avatar for siddhant3s

[U][B]Guidelines to OPs:[/B][/U] [U]Before you start a thread:[/U] Starting a thread is a critical task. It is so because it demands time and attention of other forum members. A thread should only be started when you have done enough drill to find your answer else where. You should always be …

2
471
Member Avatar for daviddoria

In a hurry: find answer at [url]http://www.gamedev.net/community/forums/topic.asp?topic_id=485378[/url]

Member Avatar for StuXYZ
0
186
Member Avatar for teddyg18
Member Avatar for teddyg18
0
6K
Member Avatar for mrinal.s2008

The std::vectors uses heap storage (dynamic memory management). When you declare an vector, vec1, all you do is instantiate a vector object. When you push_back elements in a vector, it automatically manages it and store it somewhere in the memory and stores pointers to those object with it. So now …

Member Avatar for jencas
0
103
Member Avatar for mrnutty

In general, no. But you can wrap the clock() inside a class and simulate a reset method: [code=cplusplus]class Clock { private: clock_t naught; public: Clock():naught(0){} //constructor void reset() { naught=clock(); } clock_t operator()() { return clock()-naught; } }; //demonstration: int main() { using std::cout;using std::endl; Clock stopwatch; while(stopwatch()<2 * CLOCKS_PER_SEC); …

Member Avatar for mrnutty
0
118
Member Avatar for rockyman12

>>Don't you love newbie questions?? Yes but not the trivial ones. Your question is quite trivial to even look at. There were enough resources available only if you would [URL="http://www.catb.org/~esr/faqs/smart-questions.html#rtfm"]STFW[/URL]. You wasted my minute to even look at your question. You either enjoy sadistic pleasure or you are too lazy. …

Member Avatar for Ene Uran
0
125
Member Avatar for Samuelandjw

There are a [URL="http://www.packetstormsecurity.org/programming-tutorials/C++/c++-faq/input-output.html#[15.1]"]lot of reasons[/URL] to love iostream. Standards don't say that iostream is slower or faster than stdio. But usually iostream is build by wrapping stdio hence it is usually slower in the current implementations. Until and unless you have a [I][B]VERY GOOD REASON[/B][/I] to use stdio, I …

Member Avatar for MosaicFuneral
0
1K
Member Avatar for lotrsimp12345

>search is a standard name declared in the <algorithm> header. It's a very bad >idea to use standard names even if you don't include the header because other >standard headers could include it. Indeed, This is why you are advised to explicitly qualify the names of a namespace rather than …

Member Avatar for smart_pc
0
226
Member Avatar for genepi

ISO C++ need you to explicitly mention the datatype after the 'const'. At the moment of defining C1, C2 is not defined. Read [url]http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.11[/url]

Member Avatar for siddhant3s
0
136
Member Avatar for thilinam

I would recommend a reading to [url]http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.16[/url] for a complete reference. None of the above has highlighted that the above techniques will not make the matrix contiguous except post#3.

Member Avatar for Ancient Dragon
0
162
Member Avatar for codedhands

Tell me how much time did you spent on a search engine to find your answer. In technical terms, 'saving' is known as [URL="http://en.wikipedia.org/wiki/Serialization"]serialization[/URL][1] There are plenty of libraries out there to serialize STL containers. You are fortunate enough that [URL="http://www.boost.org/doc/libs/1_39_0/libs/serialization/doc/index.html"]Boost's Serialization Library[/URL] is there on your demand. [URL="http://www.codeproject.com/KB/stl/STL_Serialization_Library.aspx"]Another library[/URL] …

Member Avatar for siddhant3s
0
866
Member Avatar for DoEds

> "[ CODE ] and [ /CODE ]" without the spaces. Next time you can use the noparse tag to tell the exact usage. [noparse][noparse] bbTags are not parse with this tag. Even if you type [code][/code] it will appear as it is. This example was created using two noparse …

Member Avatar for Tom Gunn
0
359
Member Avatar for abbiejoy21

>I won't allow myself to use that as it's just too foreign on a windows machine. I don't agree. Python guarantees that the '/' will be converted to whatever underlying platform is using. Hence it is *always* portable to use '/' instead of '\'. This guarantee is actually from the …

Member Avatar for jlm699
0
301
Member Avatar for johndoe444

>As you see in the server's response last-modified header is not set. In this >circumstances, how to force the server to give data only if the cached page at >user has been modified by the server instead of the server making every >response refreshed. Not all server support this facility. …

Member Avatar for siddhant3s
0
219
Member Avatar for TrintiyNoe

Yes, it is not possible. But ask your self: you you really need it? I never felt need of such a thing. The only close alternative is to use a [URL="www.cplusplus.com/reference/stl/map/"]std::map[/URL] something like this: [code=cpp] int main() { using std::map;using std::string;using std::cout; using std::cin; map<string,int> m; m["i"]=1; m["k"]=5; m["ok"]=53; string …

Member Avatar for TrintiyNoe
0
125
Member Avatar for TrintiyNoe

>Though people prefer using atoi() which is not a standard and which is basically >the "C" way of doing it [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/"]atoi[/URL] is as standard as the stringstream solution. The only problem is that it is not that 'good'. By good means that as the stringstream solution will rely on the …

Member Avatar for TrintiyNoe
0
128
Member Avatar for ermithun

Copy constructor is invoke when you initialize an object with another. In this case, it will be invoked something like this: [code=cpp] LDAPControlSet a; //do something with 'a'. LDAPControlSet b=a;//copy constructor invoked with 'a' as the argument LDAPControlSet c; c=b;// copy constructor *not* invoked but initialization operator invoked LDAPControlSet d(a);//explicit …

Member Avatar for ermithun
0
296
Member Avatar for dorkwad

You can do something like this: [code=cplusplus] int myints[] = {16,2,77,29}; vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) ); [/code]

Member Avatar for Tom Gunn
0
96

The End.