NathanOliver 429 Veteran Poster Featured Poster

No problem.

NathanOliver 429 Veteran Poster Featured Poster

do you have the winmm.lib library linked to this project?

http://msdn.microsoft.com/en-us/library/ms712879

NathanOliver 429 Veteran Poster Featured Poster

You are not being a douche bag epicasian. Most people here will not do this for him. We only give homework help to those who show effort.

NathanOliver 429 Veteran Poster Featured Poster

line 15 should be

int TNT_DrawSprite(tnt_Player & PlayerRef);
NathanOliver 429 Veteran Poster Featured Poster

Yes that worked. Not sure what happened with the other one. BTW it worked really well for your question. I had to break down and use my TI85.

NathanOliver 429 Veteran Poster Featured Poster

I'm having a problem trying to run this program. Is there anything special I need to do to run it. the error I'm getting is attached. Also this flagged my sonar protection with Norton but not sure if that matters.

NathanOliver 429 Veteran Poster Featured Poster

It will depend if it the list is single or double link. for single linked list if the list has a size member than you can create an array of type node and then go through the list and start filling the array from the end. Once you reach the end of the list the you can print out the array. For doubly linked list you can start at the tail node and traverse back to the front node printing the data along the way.

NathanOliver 429 Veteran Poster Featured Poster

If ent is a single pointer to a CBaseEntity then you can do

ent->frunction();

If ent is an array of CBaseEntity objects then you can do

ent[i]->function();

If you are acessing a members of the CBaseEntity object and calling a function that exist for that member than it would be

ent[i]->member->function();
// or
ent[i]->menber.function(); // if member is not a pointer

lastly if you are calling a function that returns a object and calling a function of that returned object

ent[i]->function1()->function2();
NathanOliver 429 Veteran Poster Featured Poster

Line 134 should be return str . Line 29 should be bool isLeapYear(); . That should help you a little bit.

NathanOliver 429 Veteran Poster Featured Poster

this might be a little late in the game but you could always use a vector and have the vector defined as vector<vehicle*> . with that you could add a car or a motorcycle to that vector. then when you want to remove a car or motorcycle you could do this

void VehicleManager::removeVehicle()
{
	string rnr;	
	cout<<"Enter the registration number of the vehicle to be removed"<<endl;	
	cin >> rnr;

	for(int i  = 0; i <this->m_count;  i++)
	{ 
		if(m_ppVehicles[i]->getRegNr() == rnr)					
		{	
			m_ppVehicles.erase(i);
		}
	}
}
NathanOliver 429 Veteran Poster Featured Poster

in the code you posted above you add 3 values to que1 but you only remove 2 values from it so it shouldn't be empty. to be more specific lines 6 and 7 are for que1 but line 8 is just que

NathanOliver 429 Veteran Poster Featured Poster

using getline should work for you. I would suggest this

// inside function
string serial;
cout << "Please enter a serial number. Enter to quit: ";
getline(cin, serial);
while(!serial.empty())
{
    serialNumbers.insert(serial);
    cout << "Please enter a serial number. Enter to quit: ";
    getline(cin, serial);
}

It is to be noted there is no error checking here so the user could enter a letter and it would be excepted.

NathanOliver 429 Veteran Poster Featured Poster

Here is a general purpose set up that should work for you.

int rows, cols;
// get rows and cols from user
int ** array2d;
array2d = new int*[rows];
for (int i = 0; i < rows; i++)
    array2d[i] = new int[cols];
NathanOliver 429 Veteran Poster Featured Poster

part of the problem you are having with your multiplication is you are setting carry to 1 if the result is greater than 9 but that isn't right. 7 * 7 is 49 so your carry should be 4 in this case and not 1 as you have it.

NathanOliver 429 Veteran Poster Featured Poster

Did that fix it? no need to be sorry code tags just make it easier to read. Also formating is also important a good guide is here http://www.gidnetwork.com/b-38.html

NathanOliver 429 Veteran Poster Featured Poster

I'm using MSVC++ 2005 but I thought the menus were the same when I saw 2010

NathanOliver 429 Veteran Poster Featured Poster

could you please re post your code wrapped in code tags? there is a space in the first variable name here

if (sc 1 <= sc2 && sc1 <=sc3 // space in the first sc1
&&sc1 <= sc4 && sc1 <=sc5)
NathanOliver 429 Veteran Poster Featured Poster

It should be in the build menu above the toolbar.

NathanOliver 429 Veteran Poster Featured Poster

There might be all I'm seeing is "c". ;)

NathanOliver 429 Veteran Poster Featured Poster

try the rebuild solution in the build menu

NathanOliver 429 Veteran Poster Featured Poster

Try using f7 and then f5. I normally just use the green run arrow in the toolbar. If you hold the mouse over it it say "start debugging".

NathanOliver 429 Veteran Poster Featured Poster

Maybe you could create a program that will compile the cpp files and save the assembly code into a file and then see if the assembly code is the same. Otherwise I guess you would have to create a parser and store the code as tokens and then match the tokes.

NathanOliver 429 Veteran Poster Featured Poster

How are you creating the project and what steps are you doing to debug and run the program?

NathanOliver 429 Veteran Poster Featured Poster

Yes sorry I did mean word!="\0" . In this case the call to getline leaves the string blank if there is a newline so this will work to get rid of the extra line.

if (!word.empty())
    myVec.push_back(word);

However when I was doing this and I copied your text file there was a couple extra spaces after the ? in the first sentence that was causing a problem. After I deleted those extra spaces it worked perfectly. If your program has to deal with cases like that then a different approach will be needed.

NathanOliver 429 Veteran Poster Featured Poster

Another apporach would be to use getline. Something like this should work

string filename;
cout << "Enter the filename: ";
getline(cin, filename);
ifstream OpenFile(filename.c_str());
//...

You will need to add #include<string> to your code for this to work. Also you are using the headers you have are depreacted. You have

#include <iostream.h>
#include <fstream.h>

// change that to this
#include <iostream>
#include <fstream>

BTW what compiler are you using?

Aranarth commented: Appropriate solution for the problem +1
NathanOliver 429 Veteran Poster Featured Poster

As your example shows you have a number followed by a bunch of data. You could use a map the is defined as map<int, vector<something> > . this would allow the number in each line to be the key and then the vector would hold all of the other data in the line associated with that number.

NathanOliver 429 Veteran Poster Featured Poster

there is a random shuffle function in the algorithm header that might work for you. not sure if it can be used on 2d arrays though.

NathanOliver 429 Veteran Poster Featured Poster

to test for a newline i do

if (word != '\0')
    myVec.push_back(word);
NathanOliver 429 Veteran Poster Featured Poster

you have a semicolon after your function name

void average (int sc1, int sc2, int sc3,int sc4,int sc5);  <---  get rid of this
{
    // ...
}
void findLowest (int sc1, int sc2, int sc3, int sc4, int sc5);   <---  get rid of this
{
    // ...
}
NathanOliver 429 Veteran Poster Featured Poster

Lines 50 and 51 in your orginal post do not have a return statement in them.

NathanOliver 429 Veteran Poster Featured Poster

I saw your private copy constructor in Flob.h but I do not see it defined in Flob.cpp so that might be why. If it is defined somewhere let me know so i can take a look. It might not be the copy constructor but better to make sure it isn't it right?

NathanOliver 429 Veteran Poster Featured Poster

Where do you use the Flob class? if you are making copies of objects that might be your problem since you don have a copy constructor defined. What would happen if you add a copy constructor to your Flob class?

NathanOliver 429 Veteran Poster Featured Poster

Sorry about saying it was a operator precedence thing. I had this thread confused with another one.

NathanOliver 429 Veteran Poster Featured Poster

why do you have median in your main paramaters? medain should be defined in main

int main()
{
    float meadian = 0;
    // rest of your code
}
cloudulous commented: great help +0
NathanOliver 429 Veteran Poster Featured Poster

you are not actualy defining string B. to define it to be be you could do this

string B = "B";
NathanOliver 429 Veteran Poster Featured Poster

Yes that would. He said he had a operator precedence problem that he fixed and it works now.

NathanOliver 429 Veteran Poster Featured Poster

What compiler are you using? fstream.h and iostream.h are big no no's. It should be

#include <iostream>
#include <fstream>

Also I'm not seeing a using namespace std; . Does this actually compile?

NathanOliver 429 Veteran Poster Featured Poster

I'm not seeing median declared in your main function at all. also the median is average value of all the values in the array. to calculate that you need to loop through the array and add all the values together. After that you then dived that sum by the number of elements to get the average. Also you need t pass the value median into your function by either a pointer or a reference so that what you do to it inside the function is reflected in main. Passing by value as you are doing now will not change the value of median in main().

NathanOliver 429 Veteran Poster Featured Poster

Deleting a null pointer will throw an exception but it is safe to do. I was able to call delete on null pointers back when I had MSVC++ 6.0. here is a little piece of the c++98 standard. This is from 3.7.3.2 paragraph 3

The value of the first parameter supplied to a deallocation function shall be a null pointer value, or refer to storage allocated by the corresponding allocation function (even if that allocation function was called with a zero argument). If the value of the first argument is a null pointer value, the call to the deallocation function has no effect. If the value of the first argument refers to a pointer already deallocated, the effect is undefined.

NathanOliver 429 Veteran Poster Featured Poster

there is a problem with your search user function. you never initialize i. your call to cin replaces the account number with whatever the user enters. to search for a record you need a for loop to check the number entered by the user against the numbers stored in the array. not sure if this is the function your talking about though.

NathanOliver 429 Veteran Poster Featured Poster

Actually deleting a null pointer or one that has been set to zero is perfectly safe. Trying to delete a pointer again before setting it to null or 0 is not safe. Here is a link to the MSDN page I'm using for my argument. http://msdn.microsoft.com/en-us/library/h6227113%28VS.80%29.aspx

NathanOliver 429 Veteran Poster Featured Poster

well you need to use fstreams. Namely a ofstream. you can create a ofstream like this

ofstream fout("experiment.dat");

// then use fout like cout

fout << name << title << whatever;

the file streams have the same functions and work the same as the console and keybord streams. here is a link for ofstream http://www.cplusplus.com/reference/iostream/ofstream/

NathanOliver 429 Veteran Poster Featured Poster

This is a link to Narue's sticky on posting questions
http://www.daniweb.com/forums/thread78223.html

As far as I'm concerned this should be read by everyone who joins before the start posting.

jonsca commented: Yes. If only everyone could read simple instructions. +4
NathanOliver 429 Veteran Poster Featured Poster

have you tried to use the new and delete function instead of C functions?

float * velx = new float[size];

// later on

delete [] velx;
velx = 0;
//or
velx = NULL;
NathanOliver 429 Veteran Poster Featured Poster

have you though about using the STL instead of arrays of pointers. I would suggest a list if you are going to be adding or deleting elements anywhere in the list or a vector if you are only going to be adding or removing elements from the end. from the look of your code i think a list would work well for you.

NathanOliver 429 Veteran Poster Featured Poster

On a side not you should never use the increment operator on a number that hasn't been initialized. line 2 should be int number = 0;

NathanOliver 429 Veteran Poster Featured Poster

I'm not sure if you would want to do that though AD. If the function modifies the string wont that cause a problem? http://www.cplusplus.com/reference/string/string/c_str/ says that the string should not be modified.

NathanOliver 429 Veteran Poster Featured Poster

As far as I know no. If the function you are passing the string to doesn't need to modify the string i would just change the function to except a const char * instead of a char *. If the function does need to modify the string or you cant change it you would have to copy the string into a c string and then pass that c string into the function.

NathanOliver 429 Veteran Poster Featured Poster

to pass a string as a char * to a function if that string is in a vector you would do

Foo(client_message[i].c_str());
NathanOliver 429 Veteran Poster Featured Poster

I don't believe he has a return in main as well. It's hard to tell without any indenting. Also I have never done it but is it legal to call main in a function? I always just use a return statement.