518 Posted Topics

Member Avatar for vkarthik

>destructor will probably not be called Yes, It will not be called >what happens to the memory allocated for str? It will be released by the compiler as soon the object of [B]Sample[/B] gets out of scope >Would this result in a memory leak? No. Remark: The compiler assures that …

Member Avatar for vkarthik
0
165
Member Avatar for Mossiah
Member Avatar for siddhant3s
0
84
Member Avatar for greg022549
Re: help

Please be specific. No one has time to look at your 1MB code and point out the error.

Member Avatar for siddhant3s
0
87
Member Avatar for homeryansta

Keep it simple. You should perhaps say that you want to write a parser. I guess you already have made the [B]stack[/B] class. At any point of time the comparison operator works with characters too.

Member Avatar for homeryansta
0
117
Member Avatar for atreides27

The error is definitely right. You are using uninitialized [I]d[/I] and [I]c[/I]. So what to do? Look at the defination of [CODE]AltMoney read_money() { [B] [COLOR="Red"] int d, c;[/COLOR][/B] cout << "Enter dollar \n"; cin >> d; cout << "Enter cents \n"; cin >> c; blah blah }[/CODE] I think …

Member Avatar for siddhant3s
0
450
Member Avatar for JohnnyG23

>can't quite figure out how to get the queue to appear on screen. [B]Complete the queue::print() function.[/B] First of all, make print() a member function of the class. In the print () function, you should simply print your main data array which is. int a[SIZE]; from front to rear with …

Member Avatar for Lerner
0
96
Member Avatar for colmcy1

The code tags are [[B]CODE=c++[/B]][[B]/CODE[/B]]. You are getting the error because you are redefining myfile at two places: first as ifstream and then as ofstream which is illegal. use fstream instead as: [CODE] fstream myfile; myfile.open(filename); [/CODE] As I can see, your array is of type double. getline() works only …

Member Avatar for 10Pints
0
272
Member Avatar for JameB

There is a much better way: Just add a [icode]i--[/icode] in the body of the if statement; [code=c++] for (int i = 0; i < inp.length(); i++) { if (inp[i] == '~') { inp.erase(i, 1); i--; } } [/code] And it works like charm. I dont know why are you …

Member Avatar for GDICommander
0
134
Member Avatar for sam_sumit184

You can use system() function and issue a copy command. I don't know what are the alternative. But this will definitively work.

Member Avatar for siddhant3s
0
58
Member Avatar for viv_daniweb

You have any idea what are you asking? We don't know you, nor your ability, nor that how much time you have, not how much brains you have. We know nothing of you then how can we tell what is a "mini" project for you. Mini can be a Hello …

Member Avatar for siddhant3s
0
164
Member Avatar for tux4life

Well well, I guess the "My fav IDE/Compiler war" stared again!! >Code::Blocks is too heavy I meant that it has too much options I don't use I have a simple reply.....Don't use the "much options". Code::Block appears great to me. On both Linux and Windows. I have heard very (surprisingly) …

Member Avatar for tux4life
0
170
Member Avatar for homeryansta

When a file is opened is in Text Mode, the operating system's new-line character is auto-magically converted to the standard '\n'. >Not sure what MAC uses. BTW Mac uses "\r". "On unix systems, the standard end of line character is line feed ('\n')." source: [url]https://developer.mozilla.org/En/C___Portability_Guide[/url]

Member Avatar for DemonGal711
0
296
Member Avatar for abacuswalker

Although Salem had clear it up all, but maybe for a reference you can read :[url]http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.11[/url]

Member Avatar for siddhant3s
0
105
Member Avatar for shasha821110

Class String; the "C" of class is capital. Well, anyways, I really don't know what does ensureSize() do (please provide its defination) I also don't know about >> [code] os << "S(" << temp.m_length << "," << temp.m_bufSize << ")[" << temp.m_buffer << "]"; [/code] Explain me why did you …

Member Avatar for siddhant3s
0
77
Member Avatar for raineloire11

If you are a learner and still in basic stage, I prefer you write your own class about Date and overload the comparison operator, and then work with them.

Member Avatar for siddhant3s
-1
95
Member Avatar for xonxon

Read here about Constructor :[url]http://www.parashift.com/c++-faq-lite/ctors.html[/url]

Member Avatar for siddhant3s
0
99
Member Avatar for xonxon

>Help me!!!! about operator overloading It doesn't work like this. You should be more specific about what you want to ask. First of all read this link -> [url]http://www.parashift.com/c++-faq-lite/operator-overloading.html[/url] and come back. BTW a short answer to why we use operator overloading is so that our class have a intuitive …

Member Avatar for siddhant3s
0
105
Member Avatar for cevion

Why the heck you are using cstrings. They are old, they are evil and they can lead you in trouble. Use std::string and be happy in life.

Member Avatar for siddhant3s
0
110
Member Avatar for ephums

Point 1: n*(n+1)/2 is even valid for n=1, so you don't need a degenerate case of n=1. Point 2: as vmanes said, your base case is good, but look at your recursive case: [ICODE]return (n+sum(n+1))[/ICODE] Try to think what would happen if I call sum(2)? it would return 2+sum(2+1) which …

Member Avatar for siddhant3s
0
95
Member Avatar for tyoung4@runner

[QUOTE=tux4life;813512] Hope this helps...[/QUOTE] Yeah, it will surely help him. He will copy-paste the code and will forget where he committed mistake.:angry: Did you tried explaining him where he went wrong Please note: I know no one gets paid to help here. I even know that you can debug the …

Member Avatar for tyoung4@runner
0
305
Member Avatar for aminpost

Create a static member in your class which is a bool type 2D array (call it say,[B]current_pos[/B]) of 8X8 elements. Each time you assign a Position to the object, be sure to mark the current_pos[x][y]=TRUE; So, now you can keep track of what all postition are been ocupied. Hence, as …

Member Avatar for siddhant3s
0
123
Member Avatar for Acis

[ICODE]if (gmOption == 1)[/ICODE] change it to '1' not 1 since gmOption is a char not a int. [CODE]cin >> cheat; if (cheat == 236)[/CODE] I think the cheat is 236 right? So it should be a string. Define your cheat as[ICODE] char cheat[3[/ICODE]] and not simply as a char …

Member Avatar for siddhant3s
1
160
Member Avatar for deerowbear
Member Avatar for 00Vic

I have little bit modified your code and it is working. The only drawback is that it cannot handle more than one digit nos. at any point of time during calculation. I have commented the code and am sure that you will understand it. Though, I will explain it completely …

Member Avatar for 00Vic
0
2K
Member Avatar for noty1

We only give homework help to those who show effort [url]http://www.daniweb.com/forums/announcement8-2.html[/url] Show efforts=get help

Member Avatar for siddhant3s
0
91
Member Avatar for ox99racer

What a crap this code is...........? And you say you just want it to compile.!! Read your text book first.

Member Avatar for tux4life
0
110
Member Avatar for Brandon515

Wow, a zig-zag flow of control. But is definitely not a wow. Sit down with a pencil-paper and design a flow chart of your program. The flow of program is not efficient. main calls read/write which calls haha which can in turn call read/write and so on. This is definitely …

Member Avatar for siddhant3s
0
100
Member Avatar for rudasi

n^3 + (3n^2+2^n+1)^3 + (3n^3+3n^2+2^n)^3 = (3n^3+3n^2+2^n+1)^3 In the above equation, put different value of n=1,2,3,4,...... and you get the quadruplets. BUT remember that this was a short-cut which I gave you. You should know how this was derived. Currently I don't have enough time to explain it. Read:[url]http://www.geocities.com/titus_piezas/RamCube.htm[/url] for …

Member Avatar for siddhant3s
0
207
Member Avatar for ellimist14

Please search the thread's before: [url]http://www.daniweb.com/forums/post814395.html[/url] <<here you may find something useful.

Member Avatar for siddhant3s
0
126
Member Avatar for orwell84

Look at your for loop. Mathematics says that you just need to check it till [B]i<=sqrt(n) [/B]i.e. the square root of n. That is, it your input number is 33, then just check that if should not be divisible by any number from 2 to sqrt(33) which is 5. So …

Member Avatar for siddhant3s
0
127
Member Avatar for Taniotoshi

>Yeah I know, this instanciation + use of Printer here looks definitely dodgy. You are using dynamic memory management using [B]new[/B]. Be sure to free the memory with [B]delete[/B]. >Why do I get these errors? These are the Linking error you are getting. Its probable that you are not including …

Member Avatar for Taniotoshi
0
616
Member Avatar for blahblah619

[QUOTE][code] // print output ofstream fout; fout.open("aboutYou.txt", ios::app); fout << endl; fout << age << endl; fout << gpa << endl; fout << name << endl; fout << gender << endl;[/code][/QUOTE] You told me that output should go to the screen, right? Then just tell me why are you outputting …

Member Avatar for siddhant3s
0
271
Member Avatar for jeevsmyd

You got this code from a C++ Teacher? LOL Does'nt look like Anyways, I prefer you should first read about files and streams rather than geting a readymade answer. I can answer you thingy, I cam remake your whole code also, but then there is no point in doing it …

Member Avatar for siddhant3s
0
107
Member Avatar for phillipdaw

This is the Error I get when running your program on g++ with -Wall flag on,phillipdaw is: [icode]ISO C++ forbids taking address of function ‘::main’[/icode] So, I guess that answered all the doubts regarding calling of [B]main()[/B]. So the rule of thumb: NEVER CALL MAIN() Rather than exit(0), you can …

Member Avatar for siddhant3s
0
104
Member Avatar for bhavya_talluri

[icode]#include<conio.h>[/icode]? conio.h is not standard header. Don't include it. Why do you need it?

Member Avatar for siddhant3s
0
413
Member Avatar for jitendra.theta

[QUOTE=jitendra.theta;812147] what i have read that ++c or c++ returns a value which can't be again incremented or decremented (like 5++). .[/QUOTE] You have read wrong. You are though right by saying both of these operator returns a vale, but the pre-fix(++x) return that value by reference. That means it …

Member Avatar for siddhant3s
0
107
Member Avatar for Fouly

[QUOTE=daviddoria;811883]I've never done this, but it doesn't look you passed any arguments [/QUOTE] You are right. he has just called the program without any command line argument. Also, you answered it rightly to him. As a matter of explanation: the system() function takes a Cstring and pass it to the …

Member Avatar for siddhant3s
0
681
Member Avatar for arpeggio54

You are actually doing crime here but letting the compiler generate the copy constructor and the assignment operator, Look closely what [ICODE]Inst = A(4);[/ICODE] do(sorry Comatose, I am answering that): On the right side of the assignment operator, a temporary object is created, a copy constructor is called which copy …

Member Avatar for siddhant3s
0
123
Member Avatar for Lotus_2011

[QUOTE=Lotus_2011;813447]How to get information about big nums can you help me with searching... thanks in advance ...[/QUOTE] Atleast try searching. Google is your friend. BTW, you can start somewhere here: [url]http://www.google.co.in/search?q=implementation+of+big+numbers+in+c%2B%2B[/url] [url]http://www.daniweb.com/forums/newpostinthread176976.html[/url] [url]http://ittb.pcriot.com/forum/viewtopic.php?t=23[/url]

Member Avatar for siddhant3s
0
110
Member Avatar for di mo

I remember I once made a similar code. You can study that and see if it makes any benefit to you. If any query regarding the code ask back. [B]The N Digit Calculator [/B] [url]http://ittb.pcriot.com/forum/viewtopic.php?t=23[/url]

Member Avatar for di mo
0
457
Member Avatar for arpitha_ks

A quick point to note is that g++(and other compiler that support c99) allow VLA(Variable Length Arrays), if which you can specify a variable as the length of the array. i.e. the following statement are valid [code] int a,b; cin>>a>>b; int arr[a][b]; [/code] But then, the C99 standards are not …

Member Avatar for siddhant3s
0
87
Member Avatar for MyRedz

[code]int main() { Coord a;//this thing is the trouble maker [/code] Do you realize that you want to create object without giving any parameter. This was good if you had defined a no-argument constructor. Although, there was no need for a no-argument constructor as the compiler generates auto-magically for you …

Member Avatar for siddhant3s
0
134
Member Avatar for lesodk

[code]file.open("book.txt", ios::app);[/code] Do you see that ios:app? It is telling the compiler to append whatever to book.txt So, if you want to start afresh, just remover that ios::app tag Use [code]file.open("book.txt",ios::trunc);[/code] or you can even simply use [code]file.open("book.txt");[/code]

Member Avatar for MosaicFuneral
0
244
Member Avatar for acardiac

Did you google them? I mean, I would have to type a long essay about them. Read:[url]http://cplus.about.com/od/learning1/ss/clessontwo_7.htm[/url] [url]http://www.linuxtopia.org/online_books/programming_books/c++_practical_programming/c++_practical_programming_077.html[/url]

Member Avatar for rudasi
0
128
Member Avatar for FEARmike21

I agree with, VernonDozier. cin>> is already overloaded for you to input the right thing. cin.get is a unformated input function. It does not format the input accordingly. It is just used for char heres the prototype [code]get ( char* s, streamsize n );[/code]

Member Avatar for rudasi
0
95
Member Avatar for rmlopes

Dude, #'s are [B]Pre[/B]processor directives. That means all of those things are done before compiling your code. So here how it goes. First, the preprocessor work on all the #'s and make the code ready for compilation it doesnt even see your code. nor does the preprocessor knows c/c++. It …

Member Avatar for siddhant3s
0
212
Member Avatar for FEARmike21

First follow the Ancient Dragon comment. then parse the whole string by checking each letter, run a for loop. I dont know if your using c++ string or cstrings. I am explaining using cstring [code] char str[MAX]; cin.getline(str,MAX); int len=strlen(str); for(int i;i<len-1;i++)//run till lenght -1 { if(str[i]=' ') toupper(str[i+1]); } …

Member Avatar for siddhant3s
0
152
Member Avatar for mohammad8065

Mate you dont need gotoxy(). Neither it is standard nor it is needed. I'll give you a hint which is already posted, use white space. It means to place required number of spaces (' ') before printing the characters : [code] ______# _____### ____##### ___####### __######### [/code] here the underscore …

Member Avatar for siddhant3s
0
262
Member Avatar for C++.java

line 20!! shouldnt that be in a loop? and why do you use so many useless variables(d,e,f,g,h). Just say d=(n*(n+1))/2 sum2=pow(d,2)//squaring d

Member Avatar for siddhant3s
0
176
Member Avatar for lil_panda

What I am guessing is that you dont have the source of of the .obj(or .o) file. Don't worry. If you know what all prototypes where there in the source file, you can create a header file which have all the prototypes and then compile it. It will compile easily. …

Member Avatar for ArkM
0
169

The End.