1,426 Posted Topics

Member Avatar for MareoRaft

You can use setpercision() to do this. [URL="http://www.cplusplus.com/reference/iostream/manipulators/setprecision/"]Here[/URL] has some good examples.

Member Avatar for MareoRaft
0
201
Member Avatar for sadsdw
Member Avatar for sadsdw
0
96
Member Avatar for reallyslick
Member Avatar for ztdep
0
814
Member Avatar for bigdan182

On line 29 you are declaring structs for each variable. [code=c++] void setup (struct team one, struct team two, struct team three, struct team four, struct team five, struct team six, struct team seven, struct team eight) [/code] It should be [code=c++] void setup (team one, team two, team three, …

Member Avatar for NathanOliver
0
149
Member Avatar for Kerlix

[icode]cout << "Welcome to the gradebook for\n" ; getCourseName()[/icode] there is a semicolon when there should be a <<. As far as i know there is not a <stream> header file. Why are you including it?

Member Avatar for Caligulaminus
0
312
Member Avatar for radiata

I'm not going to give any code but I will help you out with the logic. 1) Set a counter for letters removed to 0. 2) Using a for loop grab a char from the array. 3) Using another for loop start from the position of the char you grabbed …

Member Avatar for NathanOliver
0
854
Member Avatar for amaanbhae

[code=c++] class String { }; [/code] Here is a string class for you. All you need to do is fill in the blank

Member Avatar for Ketsuekiame
-5
181
Member Avatar for rayden150

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

Member Avatar for WaltP
0
258
Member Avatar for vicious217

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

Member Avatar for WaltP
0
1K
Member Avatar for evilguyme

You have a semicolon after the function. [code=c++] private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e); <--- this shouldn't be here { //... } [/code]

Member Avatar for mike_2000_17
0
288
Member Avatar for ben1996123

IF you want quit to work right you need to add [icode]return 0;[/icode] after line 91 in your else if block. [code=c++] else if (playerCreateChoiceOrNot == 5) { quit(); return 0; } [/code]

Member Avatar for WaltP
0
236
Member Avatar for nora-s

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

Member Avatar for NathanOliver
0
232
Member Avatar for fashxfreak

Wouldn't this be O(n)? [code=c++] 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 …

Member Avatar for m4ster_r0shi
0
122
Member Avatar for radiata

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. [code=c++] void CombineFile(ifstream& infile1, ifstream& infile2, ofstream& outfile) { std::vector<int> numbers; //... // read in data from both files into …

Member Avatar for WaltP
0
123
Member Avatar for Zvjezdan23

What firstPerson did was to change 2 to 2.0f which ias a floating point number. This is important because there is no [icode]pow(int, int)[/icode] defined in the math library. For a list of the ways you can use [icode]pow()[/icode] check [URL="http://www.cplusplus.com/reference/clibrary/cmath/pow/"]this[/URL] out.

Member Avatar for mrnutty
0
163
Member Avatar for bigdan182

Okay [icode]teamstructure()[/icode] 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 [icode]main()[/icode] then you have a couple of options. You can declare the teams globaly like [code=c++] …

Member Avatar for NathanOliver
0
192
Member Avatar for Sonia11
Member Avatar for bigdan182
Member Avatar for MareoRaft

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

Member Avatar for NathanOliver
0
140
Member Avatar for bimoweemo

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?

Member Avatar for NathanOliver
0
207
Member Avatar for MareoRaft

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 …

Member Avatar for mike_2000_17
0
300
Member Avatar for MareoRaft

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. [code=c++] // this can cause …

Member Avatar for mrnutty
0
150
Member Avatar for bigdan182
Member Avatar for mike_2000_17
0
221
Member Avatar for newbee234
Member Avatar for radiata

what happens if you try [code=c++] double max(double a, double b, double c) { if (a > b && a > c) return a; if (b > a && b > c) return b; return c; } [/code]

Member Avatar for Nick Evan
0
206
Member Avatar for fsefsef23

The problem is the is a newline left after you get the last number. After line 41 add [code=c++] fp.get(); [/code]

Member Avatar for fsefsef23
0
251
Member Avatar for Celtrix
Member Avatar for Celtrix
0
111
Member Avatar for clickspiker23

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 [icode]break;[/icode] it should do what you want it to do.

Member Avatar for NathanOliver
0
174
Member Avatar for Geowil
Member Avatar for byrosport

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

Member Avatar for byrosport
0
284
Member Avatar for byrosport

why the double [URL="http://www.daniweb.com/software-development/cpp/threads/371661"]post[/URL]?

Member Avatar for WaltP
0
291
Member Avatar for byrosport

Well to do this you need to know about arrays. Then you can check out [URL="http://www.cplusplus.com/reference/iostream/ifstream/"]here[/URL] 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 …

Member Avatar for NathanOliver
0
309
Member Avatar for FoxInBoots
Member Avatar for NathanOliver
0
126
Member Avatar for deliezer
Member Avatar for TheLittleEngine

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.

Member Avatar for Stefano Mtangoo
0
214
Member Avatar for SilentCoder
Member Avatar for theguitarist

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

Member Avatar for m4ster_r0shi
0
189
Member Avatar for NathanOliver

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 …

Member Avatar for NathanOliver
0
367
Member Avatar for Dingbats

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

Member Avatar for Dingbats
0
1K
Member Avatar for nocloud
Member Avatar for packluv12

Line 69-73 should be [code=c++] if (list[i] > list[winInd]) { winInd = i; } [/code] What you originally have is if the votes are less then zero then set the index to the number of votes. What I wrote says is if the votes at this index are more than …

Member Avatar for packluv12
0
97
Member Avatar for ShadowBorn

Well what do you have so far? As far as using a c-string or a string object you can have you function take in a char * and then convert it to a string like [code=c++] void foo(const char * bar) { string temp(bar); // do stuff } [/code] As …

Member Avatar for NathanOliver
0
147
Member Avatar for mchin131

the reason you are only getting one set of inputs from the file is because you only read it once. On lines 26 and 27 you read in from the files and store the data into your variables and that is the only time you put anything into those variables. …

Member Avatar for NathanOliver
0
156
Member Avatar for sadsdw

When you say you need to update the auxID many times what exactly do you mean? What is meant by "become different of zero"? If you simply want to make sure that auxID for every object in the map is not zero then you can do something like [code=c++] std::map<int, …

Member Avatar for sadsdw
0
146
Member Avatar for teh noobshow

You might want to look [URL="http://www.daniweb.com/software-development/game-development/71"]here[/URL]

Member Avatar for NathanOliver
0
96
Member Avatar for akhal

What is the size of the array that you are using? Are you sure you never try to read past the end of the array? If the array is very large I would suggest putting it into the free store and not into the heap by dynamically allocating the array.

Member Avatar for NathanOliver
0
419
Member Avatar for king03

I'm pretty sure the problem is coming from the fact that you are mixing input types. What happens if you change line 82 to [code=c++] cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n' ); [/code] You will have to include the <limits> header for this to work

Member Avatar for m4ster_r0shi
0
199
Member Avatar for Lilcrew

If you problem is that you are getting the same number every time it is because you are never calling srand()

Member Avatar for NathanOliver
0
303
Member Avatar for localp
Member Avatar for Ancient Dragon
0
397
Member Avatar for jackmaverick1
Member Avatar for Arbus
0
127

The End.