1,426 Posted Topics
Re: You can use setpercision() to do this. [URL="http://www.cplusplus.com/reference/iostream/manipulators/setprecision/"]Here[/URL] has some good examples. | |
Re: How is the file formatted? What type of data is in the file? | |
Re: Line 7 in your header file should be <string> not "string.h" | |
Re: 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, … | |
Re: [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? | |
Re: 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 … | |
Re: [code=c++] class String { }; [/code] Here is a string class for you. All you need to do is fill in the blank | |
Re: The factorial of 100 is 9.332621544e157 so you are getting an overflow. Try 5! And see what you get. | |
Re: 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. | |
Re: 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] | |
Re: 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] | |
Re: @ AveBik Start a new thread with your code you have so far and what is wrong with it plus all relevant error codes. | |
Re: 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 … | |
Re: 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 … | |
Re: 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. | |
Re: 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++] … | |
Re: What kind of variable is store? | |
Re: @tiredoy empty() always returns a bool. It will always return true if the vector is empty. | |
Re: 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? | |
Re: 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 … | |
Re: 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 … | |
Re: I would make a football team class and then store the class in a vector | |
Re: 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] | |
Re: The problem is the is a newline left after you get the last number. After line 41 add [code=c++] fp.get(); [/code] | |
Re: 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. | |
Re: Have you tried really installing msvc++? | |
Re: what exactly is the cypher you are using? Are you just adding or subtracting a certain amount from ever character? | |
Re: why the double [URL="http://www.daniweb.com/software-development/cpp/threads/371661"]post[/URL]? | |
Re: 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 … | |
Re: @tkud the code you posted will access an out of bounds index in the if statement. | |
Re: Can you plaese post the relevant code. | |
Re: 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. | |
Re: What line of the file do you want to read? | |
Re: A char that has an integer equivalent of 0 is an undefined character on output isn't it? | |
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 … | |
Re: In your callback function inside the switch statement you have [icode]char A_Function();[/icode]. What is this for? | |
Re: I would need to see the code of all of the objects to see what is going on. | |
Re: 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 … | |
Re: 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 … | |
Re: 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. … | |
Re: 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, … | |
Re: You might want to look [URL="http://www.daniweb.com/software-development/game-development/71"]here[/URL] | |
Re: 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. | |
Re: 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 | |
Re: [URL="http://www.daniweb.com/software-development/cpp/threads/109985"]this[/URL] might help you out | |
Re: I believe you need to forward declare one of your classes. |
The End.