1,426 Posted Topics
Re: you need to modify your cylinder class to take in the radius and than pass that to the circle class that makes up the cylinder class. Cylinder::Cylinder(int h, int r) : Circle(r) { height = h; } | |
Re: If you want it to keep going then you would need to put lines 7 through 35 inside a loop. | |
Re: You dont have to put the entire file path if the file lives in the same folder as the .exe file. Only if it is somewhere else than you need to. | |
Re: @ Melou22 - Please start a new thread if you have a question. You will also want to show the code you have so far. We dont give out the answers for homework problems but we can help you get the solution. | |
Re: In programing there are a lot of things that aren’t necessary for you to do. There are also a lot of things that you can do but shouldn’t do. The fact that the language or the compiler you are using allows you to do it doesn’t mean you should. The … | |
Re: your arrays that you are making are to large. If you are on a system that has a 8 byte double than each array is going to need approx 75GB of data. To caluculate this you take the rows x colums x size of data type. That gives you 100000 … | |
Re: You will want to use an array and a while loop to take in the input. to get the sum you would go through the array with a for loop and add all of the values. | |
Re: I am not seeing an `#endif` at the end of your Account.h file | |
Re: cin.get returns an istream reference not an int. if you want to get an single character than you would do char ch; cin.get(ch); // now ch has 1 letter from the input stream | |
Re: You probolly can get away with changing line 24 to &b = pb; | |
Re: line 22 tels the compiler to initialize an empty array. Line 28 does not make any sense to me. If you want to increase the element that you find you would use the post increment operator not the pre increment operator. | |
Re: We wouldnt know where to start. Did you try printing out the values before you divide to see where you are dividing by 0 like WlatP suggested? Learning how to debug your code is an important part of becoming a programer. | |
Re: What code do you have so far? | |
Re: Line 17 needs to be inside your if statement in your for loop. The way you have it now it will only add the last factor that you find. | |
Re: And what seems to be the problem? It is asking a lot to give us 600 lines of code and not say what problem you are having with it. | |
Re: Well if you struct is called Student_info then you would use typedef std::vector<Student_info> container_Student_info; The syntax for this is typedef std::vector<type_of_object_you_want_for_the_vector> name | |
| |
Re: You should be able to get rid of lines 64-77. If you just keep track of the smallest difference like you are already doing inside your second for loop you should be okay. | |
Re: What data type are you using for your string? Is it the string type or a char*? It also looks like your code to insert is not complete. What happenes if you want to insert into the middle of the array? How do you get the values into the the … | |
Re: Well you never initialize k before you use it as your array subscript. you never want to use a variable before you initialize it. `void main()` is NOT standard. You have two mains in your program. You should use loops instead of goto statements. Your indentation could be cleaned up … | |
Re: I have not seen a for loop used like for readin a file before. When I read from a file I use a while loop. Try doing something like this and see if it helps. #include <string> #include <fstream> #include <iostream> using namespace std; int main() { string input; ifstream … | |
Re: You should use a do-while loop instead of goto. #include <iostream> #include <conio.h> int main() { int array[100], position, c, n; char ch; bool loopAgain = false do // do instead of A { cout<<"Enter number of elements:"; cin>>n; cout<<"Enter "<<n<< " elements:\n"; for ( c = 0 ; c … | |
Re: Well do you know what the formula for the fibonacci squence is? If not it is Fn = Fn-1 +Fn-2 where F0=0 and F1=1. so to get a fib number you have to take the previous number plus the number before the previous number. Can you see know how the … | |
Re: What happenes if you use an array instead of a vector? | |
Re: To test for valid input you generally want to take the input in as a string and check to see if it satisfies the conditions for the type of input you want. If it does than you convert it to the type you want. So if you want to see … | |
Re: If you want to know about scanf() check this out. http://www.cplusplus.com/reference/clibrary/cstdio/scanf/ |
The End.