I'm trying to write a console app in visual studio 2010 that will read a set of numbers and construct a histogram that shows how many numbers are between each two numbers...if that makes sense. To clear it up, i'm looking for an output like:
0 - 10 ***
11 - 20 ****
21 - 30 **
So in that example, 3 numbers (*) have been found in the read file between 0 and 10. 4 numbers (*) have been found in the read file between 11 and 20 and so on.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Nothing so far unfortunately :/
I'm not sure how I'd load the file but am I right in thinking that an if statement would be used for displaying that stars?
Will your file be a continuous file with no returns or double spaces? Can you guarantee that? So just one continuous stream of “number space number space number space number” and so on?
If you can’t read a simple file into c++ the whole thing is a bit ambitious.
But what I would do is simply push each number into a vector as in: “vector <int> num;” and then iterate through num using 2 int variables:
This is non-tested pseudo code just typed into the box here…. Also, in order to create the vector I would need to have the answers to my first questions regarding the file format.
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Just don't see the point in talking to you any more. That's not what this forum is about. I'm not really sure why you would choose not to abide by its policies, but thankfully you don't post much. With a little luck, you'll go dormant again.
Just don't see the point in talking to you any more. That's not what this forum is about. I'm not really sure why you would choose not to abide by its policies, but thankfully you don't post much. With a little luck, you'll go dormant again.
GCDEF you are so hurtful and personal! I guess you were just made that way! I do not hope that you go away…. If you thought the “point” in talking to me was to somehow “win” than you are right… just leave it; however, should you actually be interested in an exchange of intellectual perspectives on this or any other subject, then I always welcome the opportunity of discussion!
GCDEF you are so hurtful and personal! I guess you were just made that way! I do not hope that you go away…. If you thought the “point” in talking to me was to somehow “win” than you are right… just leave it; however, should you actually be interested in an exchange of intellectual perspectives on this or any other subject, then I always welcome the opportunity of discussion!
Then I suggest you go the the discussion forum where it would be on topic. However, I'm not really interested in exchanging "intellectual perspectives" with you here or anywhere else. If you don't like the forum rules, I suggest you take them up with the moderator.
Then I suggest you go the the discussion forum where it would be on topic. However, I'm not really interested in exchanging "intellectual perspectives" with you here or anywhere else. If you don't like the forum rules, I suggest you take them up with the moderator.
Well, there you go again with your suggestions and advice…. I would like to remind you that no one (without a hyphen) asked you to comment here! I seem to remember that I was in the process of helping with (not doing) some kid’s homework, when Mr. Homework-detective (that’s a compound so we use a hyphen) butted in and got all aggressive… and used offensive words (pi***ng)….
So if you are not “really interested” in exchanging with me, get the hell out of my discussion with this poster…. You butted in, not I… I will then help here as I see fit…. If you don’t like it, then you will have to converse with me you arrogant, aggressive, angry, not very articulate, person – or stay out of it! You do not make the rules in my discussion….
And I just said all of that without a single swear word!
Did you read what I posted Rigsby? It's not that no help is offered for homework issues. We're just trying to avoid posting a full solution since that doesn't really help a beginner. If this was a math board you wouldn't post a full solution would you?
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.
- Brian W. Kernighan
Of course I read what you posted! Anything else would be ignorant.
I did not post a solution! I posted a trap that any IT teacher would immediately recognize as “from the web” so thus gave the person either a solution to a problem (if not homework) or reason to think about how to solve it themselves if homework when the teacher challenges them on it.
People, the natural solution to the problem was NOT a vector; why is that so difficult for you to understand?
Bookmarks