Forum: C++ Nov 5th, 2009 |
| Replies: 6 Views: 263 Here you have declared the variables, but then output just constant expressions...
I'd suggest googling for "basic c++" and trying some of the simple examples you find until you get familiar with... |
Forum: C++ Nov 5th, 2009 |
| Replies: 6 Views: 263 What you have there is simply a hard coded triangle. You need to write the code to setup the triangle's height and width. Give it a shot and post your problem once you try it. |
Forum: C++ Sep 8th, 2009 |
| Replies: 4 Views: 374 1) The undefined reference is because you are not linking to SaveData.cpp. Which IDE are you using (Visual studio, etc)?
2) 'retreive' should be spelled 'retrieve'.
3) you seem to still be... |
Forum: C++ Sep 8th, 2009 |
| Replies: 4 Views: 374 You have to create the array in the scope that you are going to use it! Probably the way to go here is have the retrieve() function accept a pointer to the array it will fill. Also, be careful not to... |
Forum: C++ Sep 7th, 2009 |
| Replies: 17 Views: 764 Which IDE are you using? (Visual studio, KDevelop, etc) I know in KDevelop the little command window is broken such that it just ignores cin type statements... seems very odd but I always have to... |
Forum: C++ Sep 5th, 2009 |
| Replies: 17 Views: 764 This seems to work fine for me...
#include <iostream>
#include <fstream>
using namespace std;
void skrivtilfil (string placering);
void laesfrafil ();
int main() |
Forum: C++ Aug 9th, 2009 |
| Replies: 5 Views: 304 I'm not sure what you're asking for help with, but you would want to overload << and >> so you could do something like this:
class A
{
int a,b;
};
int main()
{ |
Forum: C++ Jul 28th, 2009 |
| Replies: 5 Views: 552 I always advocate using an std::vector when possible.. can you do this:
std::vector<int*> yourVar(8); |
Forum: C++ Jul 18th, 2009 |
| Replies: 1 Views: 227 VNL (part of VXL) has several multidimensional optimizers - http://vxl.sourceforge.net/ |
Forum: C++ Jul 14th, 2009 |
| Replies: 4 Views: 299 What do you mean "return only one of the values"? A function can only return one value, and it looks like yours is... maybe you can give an example input, expected output, and current output? |
Forum: C++ Jul 14th, 2009 |
| Replies: 6 Views: 302 Please use code tags. You can find what you're looking for here:
http://www.learncpp.com/cpp-tutorial/93-overloading-the-io-operators/ |
Forum: C++ Jul 14th, 2009 |
| Replies: 10 Views: 749 I agree that it's generally a very bad idea - but if you DO have a good reason, compile with -Wno |
Forum: C++ Jul 10th, 2009 |
| Replies: 12 Views: 620 I think you need to display the plot in a separate thread. This operation will vary from OS to OS. |
Forum: C++ Jul 9th, 2009 |
| Replies: 3 Views: 536 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... |
Forum: C++ Jul 6th, 2009 |
| Replies: 21 Views: 609 oh oh, what was I thinking hahaha, you can "return" the values by reference! What you'll need to do is put a '&' here:
void getSales(double &sales, double salesTotal)
and the same with bonus:... |
Forum: C++ Jul 6th, 2009 |
| Replies: 21 Views: 609 Well that's not gona work unless you make everything global, which is a TERRIBLE idea. displayBonus() wont work for the same reason unless you call it from calcBonus(). I duno what to tell you - the... |
Forum: C++ Jul 6th, 2009 |
| Replies: 7 Views: 490 I don't understand, you are saying if it equals zero then "it is not a number"? Also, you can use this
std::string Zero = "0";
then if(Zero.compare(buf))
actually, i think compare() returns the... |
Forum: C++ Jul 6th, 2009 |
| Replies: 21 Views: 609 The getSales() function shouldn't be void - it needs to return the sales! |
Forum: C++ Jul 5th, 2009 |
| Replies: 8 Views: 394 Unfortunately I don't use windows so I can't try to help, but I have a hard time believing that error can't be produced in < 20 lines... |
Forum: C++ Jul 5th, 2009 |
| Replies: 8 Views: 394 Please use code tags and post the smallest fully compilable example that demonstrates the problem. |
Forum: C++ Jul 2nd, 2009 |
| Replies: 13 Views: 546 You could use std::vector's of std::vector's - then you don't have to worry about new() and delete(). |
Forum: C++ Jul 1st, 2009 |
| Replies: 6 Views: 433 the compare() function is just like "==" for std::strings. |
Forum: C++ Jul 1st, 2009 |
| Replies: 14 Views: 658 Surely the source code is not 18MB, try deleting the files that Ancient Dragon mentioned. |
Forum: C++ Jun 23rd, 2009 |
| Replies: 10 Views: 498 #include <iostream> 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... |
Forum: C++ Jun 9th, 2009 |
| Replies: 2 Views: 218 I believe the preferred method of reading all the lines in a file is this:
std::string line;
while(getline(fin, line))
{
//the current line is now in "line", handle it
} |
Forum: C++ Jun 8th, 2009 |
| Replies: 4 Views: 679 I believe what ithlep means for you to do is
MyFrame *mainFrame = new MyFrame(wxT("Test Harness"), wxSize(700, 600) );
if(mainFrame)
mainFrame->Show(true);
else
std::cout << "There was an... |
Forum: C++ Jun 8th, 2009 |
| Replies: 6 Views: 369 Please provide the smallest possible segment of code that isn't working, along with example input and actual output vs expected output. |
Forum: C++ Jun 7th, 2009 |
| Replies: 4 Views: 793 Where is CString declared? Is it a visual studio thing? Because CString is definitely not a standard c++ thing. |
Forum: C++ Jun 2nd, 2009 |
| Replies: 6 Views: 781 You could also use an std::vector of your struct to avoid almost every problem that will come up.
Dave |
Forum: C++ May 31st, 2009 |
| Replies: 2 Views: 312 The first compiler error I get is that your struct data_to_pass_st isn't defined anywhere. Also, I don't know where common.h is - maybe it is a windows thing?
Dave |
Forum: C++ May 28th, 2009 |
| Replies: 9 Views: 258 You don't have a semicolon after num++. There is no reason that I should have to compile your code to find out what the compiler errors are... post the compilers output next time. Also, there is not... |
Forum: C++ May 28th, 2009 |
| Replies: 9 Views: 258 |
Forum: C++ May 17th, 2009 |
| Replies: 2 Views: 491 Here is a good explanation of left shift (<<) and right shift (>>)
http://irc.essex.ac.uk/www.iota-six.co.uk/c/e5_bitwise_shift_operators.asp
Dave |
Forum: C++ May 12th, 2009 |
| Replies: 13 Views: 737 Here is what you are trying to do:
http://answers.yahoo.com/question/index?qid=20080422195554AAANJgl |
Forum: C++ Apr 18th, 2009 |
| Replies: 33 Views: 2,167 What platform are you on (linux or windows)? |
Forum: C++ Apr 18th, 2009 |
| Replies: 33 Views: 2,167 Is this an open source thing that we can download and try to compile? If so, please post a link.
Dave |
Forum: C++ Apr 6th, 2009 |
| Replies: 10 Views: 2,059 You can try VIL (part of VXL)
http://public.kitware.com/vxl/doc/development/ |
Forum: C++ Mar 23rd, 2009 |
| Replies: 6 Views: 247 Ok so Puzzle is a public member variable of Sudoku. To access it in main, you have to first create an instance of your Sudoku class
Sudoku MySudoku;
Then you can access the Puzzle variable... |
Forum: C++ Mar 23rd, 2009 |
| Replies: 6 Views: 247 Is puzzle a member of a class? Or just a global variable that was created in the .h file? Can you post your .h file? |
Forum: C++ Mar 23rd, 2009 |
| Replies: 6 Views: 247 You say
if (Puzzle[ptx]...
but you haven't defined Puzzle anywhere! |