1,426 Posted Topics

Member Avatar for JTX

Please refrain from name calling. Salem is a great poster and has some very good advice. you did not post any code or say what this is for so even i though it was asking for homework help. it is best to clearly state what is going on becuase we …

Member Avatar for NathanOliver
-1
75
Member Avatar for wilsonz91

good news is that if you have to write it in a switch statement you can use the drop through method eg [code=c++] switch (score) case 99: case 98: // so on case 90: //display info break; case 89: case 88: // so on case 80: //display info break; case …

Member Avatar for abhimanipal
0
148
Member Avatar for linq

@ ookamioni The problem OP is having is he is trying to make a win32 app work as a win32 console. In a console you generally have int main() not WinMain(). He is not missing a ";" anywhere.

Member Avatar for NathanOliver
2
196
Member Avatar for Stefano Mtangoo

a lexer is a program that runs through text and converts it into something you can use in your program an example would be a program that lets you input something like 5x^5 - 3x^3 + 20x^2 +5x -15. it would convert all of those into tokens that your program …

Member Avatar for Stefano Mtangoo
0
85
Member Avatar for TheWolverine

Here is a good link for you. [url]http://www.cppreference.com/wiki/stl/algorithm/transform[/url] If you cant figure it out still let me know.

Member Avatar for dusktreader
0
150
Member Avatar for sblass92
Member Avatar for sblass92
0
182
Member Avatar for thedoodler

Look at line 70. Notice anything particular about it? Also line 98 is wrong. Your instructions say to calculate the average of the 3 highest scores to the nearest integer. Does a double qualify as an integer? These are some things for you to look at. Remember it is better …

Member Avatar for NathanOliver
-2
140
Member Avatar for fugnut

just use an if statement and if counter is equal to zero use setprecision 0 for your variables.

Member Avatar for NathanOliver
0
169
Member Avatar for emma88

Could you please post your error meesages. Also on line 43 in your do_add() function you are doing [icode] sum = num1 + num2; [/icode] You can not do something like this since they are arrays. You would have to write a function to step through the array and add …

Member Avatar for NathanOliver
0
109
Member Avatar for isralruval

i striped down your function just to walk it through my debugger and i had to change [icode] char ch; [/icode] to [icode] unsigned char ch; [/icode] in order to get it to work. what was happening was it was using a signed char which has a max value of …

Member Avatar for NathanOliver
0
86
Member Avatar for mrinal.s2008

where are you outputting the data to the file? i have never seen it done with using the iterator normally in the while loop you should have a line like [code=c++] // in while loop fout << v1[i] << "\n"; i++; [/code]

Member Avatar for mitrmkar
0
300
Member Avatar for NathanOliver

would the workings of strlen() be something like this? [code=c++] int strlen(const char * str) { int size = 0; while (!!*str) size++; return size; } [/code] any feedback would be appreciated. also i have learned that !! will convert a value to an actual bool eg. !!104 = 1

Member Avatar for Ancient Dragon
0
149
Member Avatar for corby

according to my MSDN you should use [icode] srand((unsigned)time(0)); [/icode]

Member Avatar for corby
0
140
Member Avatar for crozbme

you are not assigning the return from s.pop() to anything. also please use code tags

Member Avatar for crozbme
0
79
Member Avatar for Suicidal_tool

why exactly are you passing an array to your collision method? wouldn't you just want to pass one object or are you trying to see if everything in that array will collide with the calling object?

Member Avatar for mitrmkar
0
175
Member Avatar for Jeff_5_7
Member Avatar for fplgenius

the problem is you are using gets() for your input and when you enter more than 10 elements the function gets() writes pass the end of the array and is casing your problem. you can make s bigger then see if s is larger than 10 and if it is …

Member Avatar for NathanOliver
0
92
Member Avatar for Nicris

functions return a reference so that there is less overhead in the function return. whatever value you store the return into will hold that value and it doesn't matter that the variable that was returned goes out of scope. [code=c++] // non reference return int foo() { int a = …

Member Avatar for NathanOliver
0
138
Member Avatar for return_Milk

the problem is when you pass an array to a function the actual thing that gets passed is a pointer to the first element of the array. the function doesn't know its an array so it doesn't know that he address after the pointer are part of the array. there …

Member Avatar for return_Milk
2
140
Member Avatar for Kakespade
Member Avatar for AmigaCarolena

lines 7 and 17-20 need to be looked at again. there is where some of your errors are coming from.

Member Avatar for EngSara
-2
141
Member Avatar for Narue

i believe i have a solution to your problem but there are more values in your sorted results than in the text file with the information to sort. for example there are two "b5"'s in your sorted results but only one in the text file. please let me know because …

Member Avatar for dusktreader
7
2K
Member Avatar for sujithy15
Re: ram

the faster the data can enter and leave the the ram the better your computer will perform. i.e. a 3ghz processor with 400mhz ram will run slower putting information into the ram than a 1ghz processor with 1ghz ram

Member Avatar for keumgang
0
147
Member Avatar for mebob

you are getting a overflow and that is what the return value becomes. your call to pow when k=10 for instance returns 1.5556504132421497887188538979512e+174 but the max value for a float is 3.40282e+038. i would try using type double which has a max of 1.79769e+308.

Member Avatar for vmanes
0
441
Member Avatar for gertails

To EngSara and gertails please read this [url]http://www.daniweb.com/forums/announcement8-2.html[/url] . This forum is designed to help people find answers not to give them to them. This was assigned as homework for a reason. People must show effort otherwise the learning process does not happen as it should.

Member Avatar for Nick Evan
-2
106
Member Avatar for invisi

To jBat and invisi I would reconsider your input methods. you are using [icode] cin >> val; [/icode] which will cause an infinite loop to occur if if something other than a char is entered. I would suggest the use of [icode] get(cin, val); [/icode] instead and then convert if …

Member Avatar for WaltP
0
126
Member Avatar for juman2010
Member Avatar for MatthewSedam

[icode] if (answer!=df1/df2) [/icode] Very scary. You should not compare floating point numbers this way because it will not always work. here is a good link on why. [url]http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.17[/url]

Member Avatar for mrnutty
0
188
Member Avatar for mswezey

[code=c++] #include statements using statements global vars ie ofstream fout; or ifstream fin; function prototypes int main() { //... [/code] this is the style i use

Member Avatar for mswezey
0
3K
Member Avatar for bbabarajj

to dived you use / not \. also i(...) is not valid. if you want to multiply i by that quantity you have to do [icode] i * (1.0 / i) [/icode]. Also please use code tags. the link to explian them is [url]http://www.daniweb.com/forums/announcement8-3.html[/url]

Member Avatar for bbabarajj
0
2K
Member Avatar for Dewey1040

well first of your calling getline twice. once after your for statement and once after your if statement. also you should not use eof() while reading to the end of the file. you can search around and find some good links about that. i would get rid of the for …

Member Avatar for WaltP
0
178
Member Avatar for tformed

well since some one already kicked the dead horse ill join in. the guy is looking for the cubed root of a number. lets say its 27. the answer would be 3. now lets say its -27. it would be imaginary right? wrong it exist. if you take -3 and …

Member Avatar for NathanOliver
0
697
Member Avatar for PDB1982

srand() seeds the rand() function. a good way to get a random seed is to use the time function because it changes every time you use it. it should be used as follows for general uses [code=c++] //... srand(time(NULL)); value = rand() % 365 + 1; //... [/code] you will …

Member Avatar for mrnutty
0
459
Member Avatar for jangozo
Member Avatar for mrnutty

In the state of the economy right now what is the least amount of education a programmer should have before even trying to find a job. I have been working on computers since I was 13. I started programing in basic that comes on graphing calculators and worked up to …

Member Avatar for vaultdweller123
0
1K
Member Avatar for Skeen

I'm not sure about making it a void pointer but you should be able to make a weapons class that is the bass for all of your specific classes and then make a pointer of the base class and re assign it with your specialized class pointer. this would be …

Member Avatar for mrnutty
0
227
Member Avatar for jateshs1007

here is a good link for you. [url]http://www.daniweb.com/forums/announcement8-2.html[/url]

Member Avatar for WaltP
-1
245
Member Avatar for walter clark
Member Avatar for walter clark
0
102
Member Avatar for db132074

could you please post your code for your showArray() function. it looks like the problem will be in there.

Member Avatar for NathanOliver
0
918
Member Avatar for miteigi-san

why are you randomly accessing the file? if you are going to use the whole file i believe it would be faster to read the whole file into an array and then access the array at random points. [code=c++] string array[256]; // just a guess use whatever number you need …

Member Avatar for tetron
0
546
Member Avatar for Stefano Mtangoo

the compiler i am using is MS C++ 2005. it runs better on my machine than 2008 does and i started with MS C++ 6.0 so it was a good and easy transition for me. the minimize code feature is really nice as well.

Member Avatar for VilePlecenta
0
232
Member Avatar for green_leav

to expand an array you could do this in your code [code=c++] int MAX_SIZE = 256; // just using 256 as an example int arraySize = MAX_SIZE; int * array= new int[MAX_SIZE]; // rest of your code // while in your loop of entering data if(arraySize % MAX_SIZE == 0) …

Member Avatar for green_leav
0
154
Member Avatar for NathanOliver

Hey all. I have written a quine and I was wondering if I have the jist of it right. I'm not sure if the code needs to be longer or this would be a suitable answer. Here is what I have. btw driver.cpp is the file name for my source …

Member Avatar for NathanOliver
0
152
Member Avatar for ELBUF

the 1120 error comes from the 2019 error. if you get a LNK2019 error you will always get a LNK1102 error

Member Avatar for ELBUF
0
237
Member Avatar for richman0829

you have no braces around your while function. should be [code=c++] while (i < NUM_EXAMS) { // <- dont forget these for multy line statements. input >> examScore[i]; sumOfTheScores += examScore[i]; i++ } // <- same here. [/code]

Member Avatar for richman0829
0
289
Member Avatar for malionette

well im not sure if you have to have a cout statement to have a cin statement but [icode] cin.getline(entryA, "\n"); [/icode] should work to get in a lot of input.

Member Avatar for malionette
0
215
Member Avatar for sidra 100

also you do not have the definition of train(int) anywhere. your compiler doesn't know what to do because you didn't write the code for it.

Member Avatar for sidra 100
0
127
Member Avatar for Iamthedude

the easiest way to handle all different types of inputs is to receive them as strings and then go through them and figure out what the user entered. there are plenty of functions to help with this. the function isdigit() will test to see if the character is a number. …

Member Avatar for Iamthedude
0
119
Member Avatar for said.amsur

the problem is that you are displaying the value of the ifstream reference. your while loop is good but you need to store the data into some other variable and then display it via cout. such as: [code=c++] //... while (!myfile.eof()) { myfile.getline(line, "\n"); cout << line << "\n"; } …

Member Avatar for said.amsur
0
230
Member Avatar for iou

just for giggles can you try [code=c++] while (index < NUM_PROG && cin >> prog[index]) { if(strcmp(prog[index], "-1") break; index++; } [/code]

Member Avatar for mitrmkar
0
336

The End.