Requesting help for programming/ CS majors?
Collapse
X
-
-
Re: Requesting help for programming/ CS majors?
What we're suggesting is the logical solution and algorithms to accomplish the task. I would take the code examples' syntax with a grain of salt and just try to decipher the logic and perhaps write down a pseudocode algorithm that can then be programmed into C++ with knowledge you've learned in class. (reason why I commented my code so much).
C++ specific structures required for this assignment should have been covered in your classes.
Did you learn any sorting algorithms in your classes, Eric? Or did they just give you the pre-defineds and tell you to run with that?Last edited by rushyrulz; 10-15-2013, 03:54 PM.







Comment
-
Re: Requesting help for programming/ CS majors?
I tried to make my code so that it would match what you'd be learning in your introductory course. I think I haven't done anything too out of the ordinary.Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.Comment
-
Re: Requesting help for programming/ CS majors?
isn't that just like a couple nested for loops? much easier than a bunch of awkward input handlingComment
-
Re: Requesting help for programming/ CS majors?
this is completely unnecessary. just use cin.get() (generically istream::get()) if you really want to do this.Comment
-
Re: Requesting help for programming/ CS majors?
can someone explain clearly what the problem is askingComment
-
Re: Requesting help for programming/ CS majors?
Like I said, I didn't a function to do that directly since I primarily know Java. I was mostly answering rushy's question and not telling superfreak to implement that.Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.Comment
-
Re: Requesting help for programming/ CS majors?
I think we all posted disclaimers. I assumed Superfreak is short on time.Comment
-
Re: Requesting help for programming/ CS majors?
For sorting in alphabetical order, here's how the bubble sort algorithm would look for you:
Code:for(int i = 0; i < count-1; i++) { for(int j = 0; j < count-1; j++) { if(name[j+1] < name[j]) { char temp = name[j]; name[j] = name[j+1]; name[j+1] = temp; } } }Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.Comment
-
Re: Requesting help for programming/ CS majors?
Only somewhat on topic but I'm going to post this anyway...
When I was new to programming in general it was not remotely helpful for someone to tell me "here's the code in Java, just convert it" because I had NO idea how Java worked either at the time... not saying it didn't help you Eric, but damn did that always frustrate me when people did that.
Isn't coding so much fun though? :3
Comment
-
Re: Requesting help for programming/ CS majors?
i know, i'm just saying that this is the preferred way to extract characters from an input stream
fair enough
one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array (sticking to arrays only) or a vector.Comment
-
Re: Requesting help for programming/ CS majors?
I asked about vectors, it has to be an array. I think they're expected to just use an arbitrary size hence the special character that needs to be inputted.one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array or an vector.Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.Comment
-
Re: Requesting help for programming/ CS majors?
the best way to have this not happen is to not ask for code snippets from other people. one can instead read notes/slides, watch tutorials, go to TA/prof office hours, start assignments early...When I was new to programming in general it was not remotely helpful for someone to tell me "here's the code in Java, just convert it" because I had NO idea how Java worked either at the time... not saying it didn't help you Eric, but damn did that always frustrate me when people did that.
but no one is here to judge

the "intro" solution would just be to make a huge static array, hehone thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array (sticking to arrays only) or a vector.Comment
-
Re: Requesting help for programming/ CS majors?
The array can be as big as your name. So if I was to input Eric Herrera, it would be 11, right? What I wrote at the beginning, numbers 1 2 and 3, is literally what the teacher wrote out. So if anything, your guess is as good as mine.i know, i'm just saying that this is the preferred way to extract characters from an input stream
fair enough
one thing that the OP never mentioned and i think is somewhat important is the size of the character array. can you give more detail on this? that is, is there a size restriction? if you want to do this properly, you should be using a dynamically allocated array (sticking to arrays only) or a vector.
Comment
-
Re: Requesting help for programming/ CS majors?
Yeah you could do that. I was assuming you'd either have to pick the size of your name or just pick a value that you know you wouldn't reach. If you did that, you'd have to change the code I gave you slightly since you wouldn't need the count variable any more since you know it would be 11.Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.Comment
Comment