1,426 Posted Topics

Member Avatar for akashi
Member Avatar for spuriousgeek
0
122
Member Avatar for sofy

Well a prime number can only be divided by 1 and itself. With that you can write a function that you pass the number to check and return a bool for the resault. To find out if a number is prime you need to use the mod operator on it …

Member Avatar for sofy
0
363
Member Avatar for CodyM

Your constructor should look like this Polynomial::Polynomial() { degree = 0; coeffs = NULL; }

Member Avatar for CodyM
0
226
Member Avatar for arslan.haroon
Member Avatar for anjalirwt

What exactly is the error you are getting? Do you know where it is coming from? Posting 1400 lines of code with no indentation, no comments and poorly used variables names will not help you. You need to be specific with what you want. I doubt someone is going to …

Member Avatar for KaeLL
-1
148
Member Avatar for rajat.sethi93

Maybe you should put the check for j being greater than zero first. You might be trying to access a negative index. Have you printed out j to check what the value is?

Member Avatar for NathanOliver
0
189
Member Avatar for cacadi
Member Avatar for SphirosOkelli

for line 121 you have `double shirt_price=0, uniform_cost=0;if(feet <= 6)`. What is the if doing at the end of the line? This will have an impact on all of your other if statements.

Member Avatar for SphirosOkelli
0
110
Member Avatar for manuel.sabu

well one thing i can see is that you never reset the file stream to the begining when you go from your first while loop to your second while loop. You really need to indent your code better. As is it is very hard to follow. Here is an example …

Member Avatar for NathanOliver
0
167
Member Avatar for djbsabkcb

Couple things to point out. First `void main()` is NOT standard. main should ony return an int. Second your program is using depreciated headers. If you have an older compiler that does not support the new standard header I would suggest you get a new one. MSVC2010 express and Code::Blocks …

Member Avatar for josh2k12
0
2K
Member Avatar for vishalonne
Member Avatar for mike_2000_17
0
213
Member Avatar for Elixir42

You can pass a string to a function that needs a `char *` by using the `c_str()` method of the string class. the `c_str()` function returns a `const char *` that holds what the string contains. in order for this to work the function you are passing the string into …

Member Avatar for Elixir42
0
3K
Member Avatar for kikechithomas

You havent even posted a full program requierment and the code to show what you have done. What do you expect us to do?

Member Avatar for Lucaci Andrew
0
145
Member Avatar for acerious

Welcome to the world of dealing with floating point numbers. My suspiscion is that 1 + 2 as a double is giving you something like 3.0000000000001 which will be greater than 3. If you have a debugger where you can step through your code I would do that to see …

Member Avatar for NathanOliver
0
209
Member Avatar for jay.zyzz

How do you think this should be done when using a class instead of seperate function?

Member Avatar for jay.zyzz
0
9K
Member Avatar for alyssa.wilkins.77

line 11 should be void printout(ifstream& infile, ofstream& outfile ,string names[numRows],double results[numRows][numCol],double average[numRows]);

Member Avatar for dx9_programmer
0
332
Member Avatar for kayceedude
Member Avatar for mike12255

Depending on what you can use I would use a map to store the posistion and the charecter that needs to be deleted. then you can use the map to delete the unwanted values and to restore them as well. I have implemeted a verxion of this that does work …

Member Avatar for mike12255
0
120
Member Avatar for FreddyGIraheta

Are you asking about something like this? if(something) { if(somethingelse) { //... } else { //... ) } else { if(somethingelse) { //... } else { //... } }

Member Avatar for MandrewP
0
110
Member Avatar for Dudearoo

Well I know you want someone here to teach you but I dont see the point if there are perfectly good lessons somewhere else. http://www.cplusplus.com/faq/sequences/strings/split/ has a very good tutorial on how to accomplish what you need. I would suggest try using what is there and see what you come …

Member Avatar for ravenous
0
189
Member Avatar for challarao

It is called a copy constructor because it takes a reference to an object of its own type and creats a new object that is a copy of the object passed into the constructor. take this as an example std::string foo("foobar"); //uses single argument constructor std::string bar(foo); // uses the …

Member Avatar for mike_2000_17
0
1K
Member Avatar for on93

Are you getting the wrong answer? Are you getting any compiler errors? Have you tried splitting the equation up to see if you are getting the values you expected?

Member Avatar for on93
0
138
Member Avatar for mmmm9927
Member Avatar for Vaspar
Member Avatar for 0773247886

The problem is he wasnt wasnt able to easily get there himself thats why he asked. The person either didnt want to do it or didn't know how so by you giving them the answer it does them nothing but get them further behind in their lessons.

Member Avatar for vijayan121
0
173
Member Avatar for ShEeRMiLiTaNt

Here is some pseduo code that might help int counter = 0 original[] // array you get from user nodup[] // array without duplicates. char ch nodup[0] = original[0] loop i = 0 until size of original - 1 { ch = original[i] loop j = i + 1 until …

Member Avatar for vijayan121
0
2K
Member Avatar for ShEeRMiLiTaNt

You need a carry variable to store the addition of `*Num1 + *Num2`. then you need to add `carry % 10` to sum. After that you need to dived carry by 10 to get what needs to be carried over to the next addition. You shout get something like this. …

Member Avatar for Agni
0
248
Member Avatar for on93

! Is the factorial symbol. a factorial is defined as `n! = 1 * 2 * 3 * ... * n-1 * n`. Also 0! = 1. You will ned to write a function that will calculate that. If you know how to use a for loop it is pretty …

Member Avatar for zeroliken
0
98
Member Avatar for nishad_forums

All you need to do is use rand to get a random number in the range of your array and then use that number for the index of your array. Something like this: cout << arr[(rand() % sizeOfArray)];

Member Avatar for nishad_forums
0
314
Member Avatar for SHAHAB UDDIN
Member Avatar for NathanOliver
0
84
Member Avatar for JuliaCplus

Bump a 3 year old thread and put code on it that wont work unless the compiler was made befor 1998? The code you posted wont even work for all casses. What if the order is string 3, string 2 and string 1? No where do you print that combination.

Member Avatar for NathanOliver
0
923
Member Avatar for nheziscute22

What do you mean by having a username made of numbers? Do you want a text username that gets encrypted into numbers?

Member Avatar for NathanOliver
0
311
Member Avatar for shahzad.malik.140
Re: for

Not to be rude AD but I'll do it for $4,000 USD. A guy has to make money :)

Member Avatar for WaltP
0
134
Member Avatar for jdh1231

switch statements use an int type so if you are storing the value you are getting from the user in a char variable than you need to use a char for your cases. `1` is not the same as `'1'`. Your code should look like this. switch(input) { case '1': …

Member Avatar for NathanOliver
0
174
Member Avatar for ar123
Member Avatar for MiniApocalypse

Just get rid of the paramater in the function so it looks like this `void draw();` and then change the function like this void Creatures::draw() { al_convert_mask_to_alpha(sprite, al_map_rgb(255,0,255)); al_draw_bitmap(sprite, getX(), getY(), 0); } This will let you use the sprite variable of the class.

Member Avatar for MiniApocalypse
0
330
Member Avatar for Koji01

you need another char array and after `strcat( sn, ".txt")` you would do `strcat( filenameWithFolder, sn)`

Member Avatar for Koji01
0
634
Member Avatar for RonKevin

What is the output that you are getting? Im pretty sure Walt would tell you this but you should use meaningful titles for your threads. Asking for a specific person to check out your code doesnt really say anything about what is going on.

Member Avatar for WaltP
0
158
Member Avatar for ShEeRMiLiTaNt

Lines 112 and 116 are using the comparision equal `==` not the set equal `=` operator. Your compiler should be warning you about that. If it is not either use the -wall flag or set you compiler to treat warning as errors.

Member Avatar for WaltP
0
157
Member Avatar for Bubbles26

you can also use division and the mod operator to do this. if you want to find out how may 10's you can get out of 87 it would look like this. int amount = 87; int tens = amount / 10; // 87 / 10 = 8 amount = …

Member Avatar for Bubbles26
0
196
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
475
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
369
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
489
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
363
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
115
Member Avatar for poloblue
Member Avatar for NathanOliver
0
141
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

The End.