1,177 Posted Topics

Member Avatar for AirGear

I think you need to display the plot in a separate thread. This operation will vary from OS to OS.

Member Avatar for AirGear
0
420
Member Avatar for Embroidery
Member Avatar for daviddoria

I don't understand why can you do this: [code] Employee *emp; if (condition1) emp = new Employee(); else if (condition2) emp = new Manager(); [/code] but not this: [code] Employee emp; if (condition1) emp = Employee(); else if (condition2) { emp = Manager(); [/code] Maybe this is a TERRIBLE idea, …

Member Avatar for Ancient Dragon
0
96
Member Avatar for OffbeatPatriot

I realize this is quite an odd/complicated problem, but can you reduce the amount of code necessary to produce it? Maybe you can play around and remove as many lines as possible and still produce the error. Often that will help you isolate the bug yourself, or if not, then …

Member Avatar for OffbeatPatriot
0
611
Member Avatar for daviddoria

I'm trying to start writing tests for all of my functions as per Test Driven Development. My question is, say I construct a test for "rotate vector". It would be something like this: [code] int TestRotateVector(const Vector &V) { Vector Original(1.0, 2.0); Vector Rotated = Original.Rotate(10); //rotate 10 degrees if(Rotated …

Member Avatar for StuXYZ
0
186
Member Avatar for reyaanhelp
Member Avatar for Cloneminds

The getSales() function shouldn't be void - it needs to return the sales!

Member Avatar for wildgoose
0
226
Member Avatar for Pokenerd

I don't understand, you are saying if it equals zero then "it is not a number"? Also, you can use this [icode]std::string Zero = "0";[/icode] then [icode] if(Zero.compare(buf))[/icode] actually, i think compare() returns the edit distance, so you need to see if it equals 0, so more like [icode] if(Zero.compare(buf) …

Member Avatar for Pokenerd
0
105
Member Avatar for lancevo3

Can you extract the problem into ~ 20 lines? Maybe make a hard coded name/date/account and then just call the function that is returning the wrong value?

Member Avatar for lancevo3
0
139
Member Avatar for goody11

Please use code tags and post the smallest fully compilable example that demonstrates the problem.

Member Avatar for goody11
0
289
Member Avatar for cplusplusfool

Shivi, it may also be easier to post the very smallest compilable example that produces an error directly on the forum using 'code' tags rather than creating an attachment. This way some users can potentially see the problem right away without having to download anything.

Member Avatar for cplusplusfool
0
117
Member Avatar for kangarooblood

What is it supposed to do. Maybe you can give sample input, current (incorrect) output, and expected output.

Member Avatar for kangarooblood
0
224
Member Avatar for catchmrbharath

you should use code=cplusplus rather than code=cpp because that doesn't work! also, if you don't have / know how to use a debugger, then you should do "printf debugging" which means outputting text so you can tell where the program crashes. That will probably help you find the segfault.

Member Avatar for csurfer
0
227
Member Avatar for jcwm249

First, that is a linker error - it seems you have not defined ProcessChoice(int) in an appropriate place. Also, surely 99% of those lines of code have nothing to do with the problem. Pare down the code to about 20 lines that produces the same problem and then we can …

Member Avatar for Ancient Dragon
0
152
Member Avatar for daviddoria

i.e. [code] class A { int x = 5; }; [/code] I saw a mailing list post from October 08 where a guy asked if this was going to be added. gcc 4.4 was released April 09, so I would assume it would have been added by then? I haven't …

Member Avatar for Ancient Dragon
0
163
Member Avatar for PrincessT

It doesn't sound like the problem has anything to do with tic-tac-toe. Can you please make a much, much smaller demonstration of your problem along with input, expected output, and current (incorrect) output.

Member Avatar for kangarooblood
0
186
Member Avatar for thilinam

You could use std::vector's of std::vector's - then you don't have to worry about new() and delete().

Member Avatar for Ancient Dragon
0
162
Member Avatar for ermithun
Member Avatar for dospy

Surely the source code is not 18MB, try deleting the files that Ancient Dragon mentioned.

Member Avatar for dospy
0
249
Member Avatar for metzenes

You are correct that in standard c++ you cannot overload a function by return type alone.

Member Avatar for daviddoria
0
106
Member Avatar for peterbrowse
Member Avatar for daviddoria
0
106
Member Avatar for Democles
Member Avatar for VernonDozier
0
11K
Member Avatar for Furtano

I often zero pad things like this: [code] std::string ZeroPad(const char num, const unsigned int rep) { std::stringstream Filled; Filled << std::setfill('0') << std::setw(rep) << num; return Filled.str(); } [/code] but maybe inserting a '0' like MosaicFuneral said is more appropriate in this case?

Member Avatar for daviddoria
0
99
Member Avatar for GooeyG
Member Avatar for Q8iEnG
0
139
Member Avatar for che_che
Member Avatar for daviddoria

If I do something like this: [code] print "%08d" % 2 [/code] It will print '00000002'. However, I want to change the "8" to a "3" at runtime (to get '002' instead). I tried this: [code] MyLength = 3 print "%0" + str(MyLength) + "d" % 2 [/code] but I …

Member Avatar for daviddoria
0
138
Member Avatar for 9323170

Please make the title of your thread informative - e.g. "Opening a cdrom drive".

Member Avatar for Salem
0
111
Member Avatar for zeus1216gw

Please wrap your code in "code" tags. Also, please give us a sample input, the current output, and the expected output. I don't think you need this: [icode]#include "stdafx.h"[/icode] You should use [icode]#include <cmath>[/icode] instead of [icode]#include <math.h>[/icode] Another rule is that you should pretty much never use [icode]using namespace …

Member Avatar for nirav99
0
102
Member Avatar for lotrsimp12345

also, there should be no "=" in this line: [code] return strcspm(mystring,letter); [/code] also, did you mean for "strcspm" to be "strcpn" ? If so , that lives in cstdio

Member Avatar for daviddoria
0
147
Member Avatar for lotrsimp12345

What are you talking about? What is the code supposed to do? Can you give sample input, expected output, and actual output?

Member Avatar for WaltP
0
245
Member Avatar for Nikhar

[code]#include <iostream>[/code] is where you will find cout, etc. namespaces are ways to group functions - for example, the cout, etc you are looking for are in the std namespace, so you have to call them like this: [code] #include <iostream> int main() { std::cout << "something" << std::endl; return …

Member Avatar for siddhant3s
0
335
Member Avatar for dsladev

You could use a switch statement instead of an if and a bunch of else ifs - I never really got the difference but it's something for you to fool around with.

Member Avatar for kolosick.m188
0
522
Member Avatar for clutchkiller

Why do you want to read a character at a time? Why not use std::getline() to read a line at a time into an std::string?

Member Avatar for siddhant3s
0
176
Member Avatar for Peter_APIIT
Member Avatar for StuXYZ
0
141
Member Avatar for hiscasio

Are you talking about these functions? [url]http://www.codersource.net/cpp_date_time.html[/url]

Member Avatar for mirfan00
-1
66
Member Avatar for yun

what is an "academic automation system"? You should probably ask much more specific questions about code that is not working.

Member Avatar for s_sridhar
0
106
Member Avatar for star34

You can just throw them all into an std::set and then read them out into a vector. It will take care of the duplicates for you.

Member Avatar for NeoKyrgyz
0
114
Member Avatar for DonB

Yea, I think that generally the convention is to not include .cpp files. Surely you can make a project with any IDE. CMake is becoming pretty popular - it is a "crossplatform project building" utility - that is, in linux, you can generate a makefile or a KDevelop project. In …

Member Avatar for DonB
0
165
Member Avatar for mrcniceguy

mrniceguy - you're going to have to put in some effort before anyone here will help you. Give it a try and then we can take a look and see where you've gone wrong.

Member Avatar for mrcniceguy
0
113
Member Avatar for bjanbkboi

Please post the smallest example that you can extract, a sample input, the expected output, and the current output.

Member Avatar for ArkM
1
108
Member Avatar for lexusdominus

I believe the preferred method of reading all the lines in a file is this: [code] std::string line; while(getline(fin, line)) { //the current line is now in "line", handle it } [/code]

Member Avatar for lexusdominus
0
142
Member Avatar for jesseb07

I believe what ithlep means for you to do is [code] MyFrame *mainFrame = new MyFrame(wxT("Test Harness"), wxSize(700, 600) ); if(mainFrame) mainFrame->Show(true); else std::cout << "There was an error creating mainFrame!" << std::endl; [/code]

Member Avatar for jesseb07
0
261
Member Avatar for horiya

Please provide the smallest possible segment of code that isn't working, along with example input and actual output vs expected output.

Member Avatar for tux4life
0
133
Member Avatar for mathueie
Member Avatar for colmcy1

Where is CString declared? Is it a visual studio thing? Because CString is definitely not a standard c++ thing.

Member Avatar for colmcy1
0
799
Member Avatar for aarifameen

Wow, you didn't even take the time to say "I have this assignment, can you help me?" - you just copy and pasted directly!!

Member Avatar for siddhant3s
-1
126
Member Avatar for daino

Sounds like he was asking more about GUI type stuff rather than 3d graphics? In linux, there are a couple of main GUI libraries like QT and GTK. I'm not sure about windows. They usually have some kind of graphical designer that you can layout buttons and textboxes and whatnot, …

Member Avatar for Prabakar
0
275
Member Avatar for TheBattlizer

You could also use an std::vector of your struct to avoid almost every problem that will come up. Dave

Member Avatar for TheBattlizer
0
142
Member Avatar for vs.vaidyanathan

Please post the smallest version of your code that will produce those linker errors. Then we can see which libraries you are trying to use. Dave

Member Avatar for vs.vaidyanathan
0
122
Member Avatar for GSPprog

Can you abstract the question to something like "how do you input everything the user types until the enter key is pressed?" or something like that? I'd say 3/4 of those lines are not related to your question. Please post 1) the shortest example possible that demonstrates the problem 2) …

Member Avatar for GSPprog
0
422

The End.