1,426 Posted Topics

Member Avatar for jimmy.teohmingsiong

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; }

Member Avatar for np complete
0
472
Member Avatar for mkaynutty
Member Avatar for marius2010

If you want it to keep going then you would need to put lines 7 through 35 inside a loop.

Member Avatar for WaltP
0
365
Member Avatar for klharding2

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.

Member Avatar for deceptikon
0
485
Member Avatar for jerlisacoleman

@ 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.

Member Avatar for NathanOliver
0
361
Member Avatar for markwiering

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 …

Member Avatar for markwiering
0
1K
Member Avatar for jdh1231

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 …

Member Avatar for WaltP
0
112
Member Avatar for poloblue
Member Avatar for NathanOliver
0
139
Member Avatar for bdl365

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.

Member Avatar for bdl365
0
2K
Member Avatar for dmose13
Member Avatar for kinge504
Member Avatar for dreday92

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

Member Avatar for NathanOliver
0
102
Member Avatar for venomxxl
Member Avatar for venomxxl
0
118
Member Avatar for kshahnazari

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.

Member Avatar for NathanOliver
0
178
Member Avatar for rajat.sethi93

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.

Member Avatar for rajat.sethi93
0
205
Member Avatar for dadon1991
Member Avatar for lscamaro

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.

Member Avatar for np complete
0
272
Member Avatar for poloblue

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.

Member Avatar for deceptikon
0
193
Member Avatar for Tinnin

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

Member Avatar for NathanOliver
0
231
Member Avatar for sajis997
Member Avatar for np complete

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.

Member Avatar for np complete
1
1K
Member Avatar for ryan.wood.1042032

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 …

Member Avatar for NathanOliver
0
162
Member Avatar for Kryptonitex

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 …

Member Avatar for Kryptonitex
0
224
Member Avatar for TheRazzle
Member Avatar for ncis_sg1

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 …

Member Avatar for ncis_sg1
2
2K
Member Avatar for RonKevin

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 …

Member Avatar for RonKevin
0
340
Member Avatar for Grandiago

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 …

Member Avatar for vinnitro
0
305
Member Avatar for Jsplinter
Member Avatar for soapy.thomas

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 …

Member Avatar for m4ster_r0shi
0
398
Member Avatar for RonKevin

If you want to know about scanf() check this out. http://www.cplusplus.com/reference/clibrary/cstdio/scanf/

Member Avatar for RonKevin
0
175

The End.