10-15-2013, 04:38 PM | #41 |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
Re: Requesting help for programming/ CS majors?
Pretty much, yeah. Should've just stopped at the inputting the name part and then have them print it.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
10-15-2013, 04:40 PM | #42 |
FFR Veteran
Join Date: Jan 2007
Age: 33
Posts: 2,407
|
Re: Requesting help for programming/ CS majors?
Yeah lets do that just for safety.
__________________
|
10-15-2013, 04:41 PM | #43 |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
Re: Requesting help for programming/ CS majors?
Good. For the record, this is because of ASCII values. If you were to compare 'a' and 'b', you'd be comparing 97 and 98. Capital letters range from 65 to 90 while lowercase range from 97 to 122.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
10-15-2013, 04:46 PM | #44 |
no
Join Date: Jan 2004
Age: 33
Posts: 1,850
|
Re: Requesting help for programming/ CS majors?
i'm not sure why C idiom solutions are being suggested when the OP specifically mentioned C++. it's a terrible idea to mix and match them, don't do it.
|
10-15-2013, 04:47 PM | #45 |
Digital Dancing!
Join Date: Feb 2006
Location: 80 billion club, NE
Age: 31
Posts: 12,980
|
Re: Requesting help for programming/ CS majors?
I've had much harder assignments in introductory level classes. One of my projects was to code a sieve of eratosthenes from scratch.
__________________
|
10-15-2013, 04:48 PM | #46 |
FFR Veteran
Join Date: Jan 2007
Age: 33
Posts: 2,407
|
Re: Requesting help for programming/ CS majors?
Yes, if we could, I would like only C++ solutions. Teacher will probably be confused as to why I'm mixing them, and how I would know them, since it's intro.
__________________
|
10-15-2013, 04:51 PM | #47 |
Digital Dancing!
Join Date: Feb 2006
Location: 80 billion club, NE
Age: 31
Posts: 12,980
|
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 at 04:54 PM.. |
10-15-2013, 04:54 PM | #48 |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
10-15-2013, 04:57 PM | #49 |
FFR Player
Join Date: Oct 2013
Posts: 17
|
Re: Requesting help for programming/ CS majors?
|
10-15-2013, 04:58 PM | #50 |
no
Join Date: Jan 2004
Age: 33
Posts: 1,850
|
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.
|
10-15-2013, 04:58 PM | #51 |
FFR Player
Join Date: Oct 2013
Posts: 17
|
Re: Requesting help for programming/ CS majors?
can someone explain clearly what the problem is asking
|
10-15-2013, 05:00 PM | #52 |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
10-15-2013, 05:05 PM | #53 |
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Requesting help for programming/ CS majors?
|
10-15-2013, 05:09 PM | #54 |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
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; } } }
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
10-15-2013, 05:10 PM | #55 |
🥓<strong><span style="col
Resident Overseer
Join Date: Mar 2007
Location: Kingsport, TN
Posts: 7,648
|
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 |
10-15-2013, 05:13 PM | #56 | ||
no
Join Date: Jan 2004
Age: 33
Posts: 1,850
|
Re: Requesting help for programming/ CS majors?
Quote:
Quote:
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. |
||
10-15-2013, 05:15 PM | #57 | |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
Re: Requesting help for programming/ CS majors?
Quote:
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
|
10-15-2013, 05:16 PM | #58 | ||
new hand moves = dab
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
|
Re: Requesting help for programming/ CS majors?
Quote:
but no one is here to judge Quote:
|
||
10-15-2013, 05:17 PM | #59 | |
FFR Veteran
Join Date: Jan 2007
Age: 33
Posts: 2,407
|
Re: Requesting help for programming/ CS majors?
Quote:
__________________
|
|
10-15-2013, 05:19 PM | #60 |
Caelondia Represent
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
|
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|