NathanOliver 429 Veteran Poster Featured Poster

What happens if you try this

CDirLoader::GetFileExtHandle(not related params)
{
    std::string prefDir;
    for(size_t i=0;i<preferredPaths.size();++i)
    {
        if (!preferredPaths[i].empty()) 
            prefDir = preferredPaths[i];
            //...
    }
}
NathanOliver 429 Veteran Poster Featured Poster

The factorial of 100 is 9.332621544e157 so you are getting an overflow. Try 5! And see what you get.

NathanOliver 429 Veteran Poster Featured Poster

I am terribly sorry for my lapse in judgment ;)

NathanOliver 429 Veteran Poster Featured Poster
class String
{
};

Here is a string class for you. All you need to do is fill in the blank

NathanOliver 429 Veteran Poster Featured Poster

Is the problem you are with your cout statements? is see you are using a instead of a " . If not please post what errors you are getting.

NathanOliver 429 Veteran Poster Featured Poster

You have a semicolon after the function.

private: System::Void checkBox1_CheckedChanged(System::Object^  sender, System::EventArgs^  e); <--- this shouldn't be here
{
    //...
}
NathanOliver 429 Veteran Poster Featured Poster

IF you want quit to work right you need to add return 0; after line 91 in your else if block.

else if (playerCreateChoiceOrNot == 5)
{
    quit();
    return 0;
}
Keichemon commented: Thanks for your help. +0
NathanOliver 429 Veteran Poster Featured Poster

@ AveBik Start a new thread with your code you have so far and what is wrong with it plus all relevant error codes.

NathanOliver 429 Veteran Poster Featured Poster

Wouldn't this be O(n)?

bool CheckSymmetric(int grid[maxrow][maxcol])
{
	int counter = 0;
	for (int i = 0, m = maxrow - 1; i < maxrow; i++, m--)
	{
		for (int j = 0, n = maxcol - 1; j < maxcol; j++, n--)
		{
			if (grid[i][j] != grid[m][n])
				return false;
		}
	}
	return true;
}
NathanOliver 429 Veteran Poster Featured Poster

What firstPerson did was to change 2 to 2.0f which ias a floating point number. This is important because there is no pow(int, int) defined in the math library. For a list of the ways you can use pow() check this out.

NathanOliver 429 Veteran Poster Featured Poster

I think you would be better of reading both files into an array or vector and then sort the container. After that then write the data back into the outfile.

void CombineFile(ifstream& infile1, ifstream& infile2, ofstream& outfile)
{
    std::vector<int> numbers;
    //...
    // read in data from both files into the vector
    //...
    std::sort(numbers.begin(), numbers.end());
    //...
    // write the vector into outfile
    //...
}
NathanOliver 429 Veteran Poster Featured Poster

Okay teamstructure() is a function that takes no parameters and returns void correct? If this is the case and you want to be able to pass the teams around or to access them in main() then you have a couple of options. You can declare the teams globaly like

team one;
team two;
team three;
//...

int main() // I used a int here.  void main() is not standard
{
   teamstructure();
   std::cout << one.name;
   cin.get()  // use this to pause the program instead of system("pause")
   return 0;  // you might have to clear the input stream before for it to work 
}

Alternatively you could store the teams in a vector or an array and then pass that to the various functions

#include <vector>
void teamstructure(std::vector<team> & teams);  // using a reference so that changes stick

int main()
{
    std::vector<team> teams(8); // makes a vector holding 8 blank teams
    teamstructure(teams);
    std::cout << teams[0].name;  // displays the name of the first element in the vector
    //...
}

There other things you could do as well but you need to chose how you want it to look.

NathanOliver 429 Veteran Poster Featured Poster

Please post your code.

NathanOliver 429 Veteran Poster Featured Poster

What kind of variable is store?

NathanOliver 429 Veteran Poster Featured Poster

@tiredoy empty() always returns a bool. It will always return true if the vector is empty.

NathanOliver 429 Veteran Poster Featured Poster

Yes except for what is sz and where are you getting it from? Do you have all of your code in List.h now? What does your main .cpp file look like now?

NathanOliver 429 Veteran Poster Featured Poster

Yes Beacuse when you pass by reference you dont need to copy the entire vector like you do when you pass it by value. if you had a vector of 1000 objects each 10 bytes in size then to pass it by value you would have to copy all 10kb worth of data. passing by reference you copy 10 bytes.

NathanOliver 429 Veteran Poster Featured Poster

The return type does not come from the parameter list. To qualify as correct a function prototype you need to have have three things. You need a return type, a correct name for the function and you need to have a parameter list. The parameter list need not have any parameters but you still need the () after the name to make it a function. You also do not need to name any of the parameters in the parameters list but you do need the type specified.

// the are all correct
int foo();
void foo(int);
double add(double first, double second);
void print(void);  // okay (void) means I have no parameters

// these are all incorrect
foo();  // no return type
void foo(a);  // type of a is not specified
int 2add(int, int);  // bad name
NathanOliver 429 Veteran Poster Featured Poster

What are the types for

void function3(n, x, a, b);

?

Does

one(int a, int b);

have a return type?

NathanOliver 429 Veteran Poster Featured Poster

is void thelastone(); a proper function prototype? If not why?

NathanOliver 429 Veteran Poster Featured Poster

I would make a football team class and then store the class in a vector

NathanOliver 429 Veteran Poster Featured Poster

Line 9 in narueReader should not be there. you never want to include the std namespace into your own namspace. Same goes for writer where you include std and the matrix namespace. you should fully qualify anything used from a seperate namespace in another namespace.

// this can cause problems
namespace foo
{
    using namespace std;   // very bad
    void Print(bar & temp)
    {
        cout << temp;
    }
    //...
}

// this one is fine
namespace foo
{
    void Print(bar & temp)
    {
        std::cout << temp;
    }
    //...
}
NathanOliver 429 Veteran Poster Featured Poster

what happens if you try

double max(double a, double b, double c)
{
    if (a > b && a > c)
        return a;
    if (b > a && b > c)
        return b;
    return c;
}
NathanOliver 429 Veteran Poster Featured Poster

Well you have some wrong on every question. First can I suggest you use code tags when posting code so that it is easier to read. Question 1 ask about functions. A function is formed like

return_type Function_name(variable_type name(optional))

A function does not need to actually name the variable if it is a prototype but it does need to have the variable type.

Question 2 deals with variable naming, initializing and arrays. Can an array have a negative subscript? What does double d(4); mean?

here is a good link for learning functions.

and here you can learn up on variables

NathanOliver 429 Veteran Poster Featured Poster

What answers did you get?

NathanOliver 429 Veteran Poster Featured Poster

The problem is the is a newline left after you get the last number. After line 41 add

fp.get();
NathanOliver 429 Veteran Poster Featured Poster

What are you using that you can run windows?

NathanOliver 429 Veteran Poster Featured Poster

No where do I see a loop to read in all of the data from the file

dataFile >> prices;

Is only getting the frist record from the file.

NathanOliver 429 Veteran Poster Featured Poster

You are on the right track but you don't want to change what input is with your if statement. If you change line 21 to break; it should do what you want it to do.

NathanOliver 429 Veteran Poster Featured Poster

why the double post?

NathanOliver 429 Veteran Poster Featured Poster

After you add the data into the set all you have to do is

//...
vector<PriceInfo> data // stores the entire file
set<PriceInfo, comparePrice> smallSet // to put only sepecific days to get the lowest price
vector<PriceInfo>::const_iterator it = data.begin(), end = data.end();
string lowerDate, upperDate;  // for storing the date range
while (it++ != end)
{
    if (it->date >= lowerDate && it->.date <= upperDate)
        smallSet.insert(*it);
}
PriceInfo lowest = *(smallSet.begin());  // gets the first element which is the lowest price
cout << "The lowest price ocurd at: " << lowest.date << " " << lowest.time;
//...
NathanOliver 429 Veteran Poster Featured Poster

Sorry I meant to say reinstall. I typed that on my phone and auto complete took over. It appears that everything is related to MSVCRT.lib. I would check to make sure the file exist and is where it is supposed to be. You might also want to check that you are not trying to link to the static and dynamic lib's at the same time.

NathanOliver 429 Veteran Poster Featured Poster

what exactly is the cypher you are using? Are you just adding or subtracting a certain amount from ever character?

NathanOliver 429 Veteran Poster Featured Poster

Well to do this you need to know about arrays. Then you can check out here to find out how to open a file. You will either want to use a max function like std::max or you could use your own to find the max number in the array. Remember to start small. You can always write a function and just test that one thing to make sure that it is working.

NathanOliver 429 Veteran Poster Featured Poster

Have you tried really installing msvc++?

NathanOliver 429 Veteran Poster Featured Poster

@tkud the code you posted will access an out of bounds index in the if statement.

NathanOliver 429 Veteran Poster Featured Poster

Can you plaese post the relevant code.

NathanOliver 429 Veteran Poster Featured Poster

I found this while googeling. Might be something worth looking into

NathanOliver 429 Veteran Poster Featured Poster

Also if you create a constructor for your class don't forget to also provide a default constructor. A default constructor is only provided if there are no constructors defined.

NathanOliver 429 Veteran Poster Featured Poster

What line of the file do you want to read?

NathanOliver 429 Veteran Poster Featured Poster

Well thanks for all of the advice. I decided to install Code::Blocks and used the distros that Narue suggested. I do understand what you are saying mike but i just wanted to get a heads up on the new features so when the time comes when c++0x is readily available I'll already now some of it.

Thanks All

NathanOliver 429 Veteran Poster Featured Poster

The value of ' ' is not 0. In fact, I challenge you to input a character with the value of 0 using cin. It's not as simple as you might think.

I believe this means she is asking you to input a null into the input stream.

NathanOliver 429 Veteran Poster Featured Poster

Well the ASCII character code says that 0 = NULL so I would think that you cant exactly enter a NULL character. this is a reference that I use from time to time.

NathanOliver 429 Veteran Poster Featured Poster

A char that has an integer equivalent of 0 is an undefined character on output isn't it?

NathanOliver 429 Veteran Poster Featured Poster

Hey all,

I'm looking to upgrade my compiler and I was wondering if there is a compiler that is fully c++0x supported yet. If not is there one that is mostly supported? I am currently using MSVC++ 2005 express. I would like to stay in the MSVC++ family since I am comfortable with the debugger and the layout. I would like to start playing around with the new stuff but as far as i can tell 2005 doesn't have anything from c++0x.

Thanks all
Nathan Oliver

NathanOliver 429 Veteran Poster Featured Poster

Thank you very much Narue

NathanOliver 429 Veteran Poster Featured Poster

Thanks Narue for your answer. I wasn't sure if you could declare a function inside a function. Does that change the scope of that function to where it can only be used in the function it is declared in?

NathanOliver 429 Veteran Poster Featured Poster

In your callback function inside the switch statement you have char A_Function(); . What is this for?

NathanOliver 429 Veteran Poster Featured Poster

You should be returning by reference not by value

std::string & access(int row, int column);

csv_File & grab(int index);
NathanOliver 429 Veteran Poster Featured Poster

I would need to see the code of all of the objects to see what is going on.