1,426 Posted Topics

Member Avatar for jimJohnson

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 …

Member Avatar for NathanOliver
0
74
Member Avatar for tomtetlaw

If ent is a single pointer to a CBaseEntity then you can do [code=c++] ent->frunction(); [/code] If ent is an array of CBaseEntity objects then you can do [code=c++] ent[i]->function(); [/code] If you are acessing a members of the CBaseEntity object and calling a function that exist for that member …

Member Avatar for NathanOliver
0
130
Member Avatar for CarleneGriffith

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

Member Avatar for CarleneGriffith
0
139
Member Avatar for Chris11246

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

Member Avatar for Chris11246
0
119
Member Avatar for Prota

this might be a little late in the game but you could always use a vector and have the vector defined as [icode]vector<vehicle*>[/icode]. 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 …

Member Avatar for Prota
0
110
Member Avatar for amare_de

Here is a general purpose set up that should work for you. [code=c++] 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]; [/code]

Member Avatar for amare_de
0
193
Member Avatar for aaronmk2

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

Member Avatar for NathanOliver
0
87
Member Avatar for anuragcoder

Another apporach would be to use getline. Something like this should work [code=c++] string filename; cout << "Enter the filename: "; getline(cin, filename); ifstream OpenFile(filename.c_str()); //... [/code] You will need to add [icode]#include<string>[/icode] to your code for this to work. Also you are using the headers you have are depreacted. …

Member Avatar for abhimanipal
0
198
Member Avatar for daniel88

using getline should work for you. I would suggest this [code=c++] // 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); } [/code] It is to …

Member Avatar for daniel88
0
106
Member Avatar for bazoka121

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 …

Member Avatar for abhimanipal
0
118
Member Avatar for cl2020
Member Avatar for gregarion

to test for a newline i do [code=c++] if (word != '\0') myVec.push_back(word); [/code]

Member Avatar for NathanOliver
0
95
Member Avatar for phummon

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

Member Avatar for NathanOliver
0
185
Member Avatar for Empireryan

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.

Member Avatar for NathanOliver
0
104
Member Avatar for cl2020

you have a semicolon after your function name [code=c++] 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 { // ... } [/code]

Member Avatar for NathanOliver
0
107
Member Avatar for aleX_X
Member Avatar for NathanOliver
0
230
Member Avatar for Zcool31

have you tried to use the new and delete function instead of C functions? [code=c++] float * velx = new float[size]; // later on delete [] velx; velx = 0; //or velx = NULL; [/code]

Member Avatar for Zcool31
0
3K
Member Avatar for mrnutty

personally I'm not a big fan. I don't like all of the empty space at the bottom of a post. It makes it take up to much space. Just when I get used to the old interface they change it on me again. BTW is there a post that explains …

Member Avatar for jwenting
1
189
Member Avatar for sparkle_jam

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 …

Member Avatar for sparkle_jam
0
129
Member Avatar for kashimushi

What compiler are you using? fstream.h and iostream.h are big no no's. It should be [code=c++] #include <iostream> #include <fstream> [/code] Also I'm not seeing a [icode] using namespace std; [/icode]. Does this actually compile?

Member Avatar for chiwawa10
0
87
Member Avatar for aaronmk2

you are not actualy defining string B. to define it to be be you could do this [code=c++] string B = "B"; [/code]

Member Avatar for aaronmk2
0
85
Member Avatar for cloudulous

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 …

Member Avatar for cloudulous
0
327
Member Avatar for corby

well you need to use fstreams. Namely a ofstream. you can create a ofstream like this [code=c++] ofstream fout("experiment.dat"); // then use fout like cout fout << name << title << whatever; [/code] the file streams have the same functions and work the same as the console and keybord streams. …

Member Avatar for hnizamoglu
0
141
Member Avatar for fougere

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 …

Member Avatar for fougere
0
153
Member Avatar for jephthah

I have to agree that the post are to wide now. I have to shrink my browser in order to get a window where I don't have to turn my head to see the whole line. BTW my res is 1280 x 1024 on a 19" monitor

Member Avatar for Dani
8
2K
Member Avatar for daviddoria

This is a link to Narue's sticky on posting questions [url]http://www.daniweb.com/forums/thread78223.html[/url] As far as I'm concerned this should be read by everyone who joins before the start posting.

Member Avatar for Ketsuekiame
0
90
Member Avatar for jimJohnson

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

Member Avatar for jimJohnson
0
181
Member Avatar for helpfullProgram

to pass a string as a char * to a function if that string is in a vector you would do [code=c++] Foo(client_message[i].c_str()); [/code]

Member Avatar for mrnutty
0
165
Member Avatar for manvis2484
Member Avatar for Roses89

well you need to move your bid class above your simulator class to fix the second error because you are trying to use it before you have defined it. for the first error try using [code=c++] list.push_back ( this->getBids() ); [/code]

Member Avatar for NathanOliver
0
129
Member Avatar for anusri555

to delete a pointer and know that it will never be a problem do [code=c++] Foo* p = new Foo; // later on delete p; p = 0; // since p is zero calling delete again will be safe [/code]

Member Avatar for NathanOliver
0
74
Member Avatar for prototyppe

You have i and j initialized to size so you are actually pointing to one passed the end of the vector. Replace [code=c++] int i=(int)ask.size(); int j=(int)buy.size(); [/code] with [code=c++] int i=(int)ask.size() - 1; int j=(int)buy.size() - 1; [/code] Also with this line [code=++] matchedAsk.insert(matchedAsk.end(),ask.end(), ask.end()+1); [/code] I belive you …

Member Avatar for NathanOliver
0
62
Member Avatar for Leppie

I'm feeling helpful so I'll show you one way to do this. [code=c++] int counter = 1, x,y, zeroX, zeroY; int map[10][10]; srand((unsigned)time(0)); zeroX = rand() % 10; // this gets the spot to put the zero zeroY = rand() % 10; // place zero map[zeroX][zeroY] = 0; while (counter …

Member Avatar for Leppie
0
115
Member Avatar for yongj
Member Avatar for Fbody
0
193
Member Avatar for SortOfaTechnie
Member Avatar for NathanOliver

Hey All Yesterday I was writing a recursive form of a prime factorization program and I wasn't sure about the syntax I used. the function works as is but I'm curious if I am being redundant or if this is the proper way to code it. Here is what I …

Member Avatar for NathanOliver
0
134
Member Avatar for lllllIllIlllI
Member Avatar for Rhap

is Color part of [icode]using namespace System::Drawing;[/icode]? if not you need to include it in your point class. this is all i can get from this.

Member Avatar for jonsca
0
237
Member Avatar for vihrao

on line 6 you are doing subtraction not addition. is that a typo or is this happening in you subtraction function?

Member Avatar for VernonDozier
0
498
Member Avatar for blahbla
Member Avatar for defender_

this is because of line 17. you are setting a pointer equal to another pointer so whatever happens to temp will also happen to b. if you want only the data in b to be the same as temp but not actually point to the same object you would have …

Member Avatar for defender_
0
68
Member Avatar for Rexzie

I would look up prime factorization. That should point you in the right direction.

Member Avatar for Rexzie
0
168
Member Avatar for vihrao

as caut_baia stated you are returning a pointer but your function is defined to return just an object change this [code=c++] return rslt; [/code] to this [code=c++] return *rslt; [/code]

Member Avatar for vihrao
0
232
Member Avatar for aaronmk2

the function is constantly reducing the number untill it is less than 10. lets say the number is 100. the function would print 0 for the first time. then you check to see if it is greater than 10. since 100 is greater than 10 we will call the print …

Member Avatar for aaronmk2
0
107
Member Avatar for yongj

the problem is line 18. [code=c++] Bible::Bible(string nam, int chapt, int vers, string testa, string txt) [/code] you dont have anything defined for this function. it should be [code=c++] Bible::Bible(string nam, int chapt, int vers, string testa, string txt) { // stuff here } [/code]

Member Avatar for NathanOliver
0
366
Member Avatar for Sylviodrood

there are a bunch of post already about doing this. try this [url]http://www.daniweb.com/forums/search6116243.html[/url]

Member Avatar for mrnutty
0
76
Member Avatar for lightshift

well for starters the code you are using to populate the array with your o's and x's is not right. you are using a for loop but what would happen if the cords you get already have a o or an x? you would do nothing and then start the …

Member Avatar for lightshift
0
252
Member Avatar for eggberto

shouldnt his char array be defined as something like [icode]char script[2][50][/icode] or do i have it backwards?

Member Avatar for Salem
0
270
Member Avatar for Atlanticspace
Member Avatar for dusktreader

I think I have made a solution to this. How would you like to see my code. I didn't know if I should post it or let others have a chance.

Member Avatar for dusktreader
0
439

The End.