Go Back   Flash Flash Revolution > General Discussion > Chit Chat
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 10-15-2013, 04:38 PM   #41
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Air En Trance View Post
this assignment is a horrible way to learn arrays and input
Pretty much, yeah. Should've just stopped at the inputting the name part and then have them print it.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Old 10-15-2013, 04:40 PM   #42
Superfreak04
FFR Veteran
FFR Veteran
 
Superfreak04's Avatar
 
Join Date: Jan 2007
Age: 33
Posts: 2,407
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Kibblre View Post
So then you'd want the output like I described? It'll be tough to make it aAbBcCdD
Yeah lets do that just for safety.
__________________
Superfreak04 is offline   Reply With Quote
Old 10-15-2013, 04:41 PM   #43
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Superfreak04 View Post
Yeah lets do that just for safety.
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Old 10-15-2013, 04:46 PM   #44
Fission
no
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Fission's Avatar
 
Join Date: Jan 2004
Age: 33
Posts: 1,850
Default 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.
Fission is offline   Reply With Quote
Old 10-15-2013, 04:47 PM   #45
rushyrulz
Digital Dancing!
Retired StaffFFR Simfile AuthorFFR Music ProducerD7 Elite KeysmasherFFR Veteran
 
rushyrulz's Avatar
 
Join Date: Feb 2006
Location: 80 billion club, NE
Age: 31
Posts: 12,980
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Kibblre View Post
If this is an introductory course then he's making you do some tricky stuff for that level.
I've had much harder assignments in introductory level classes. One of my projects was to code a sieve of eratosthenes from scratch.
__________________


rushyrulz is offline   Reply With Quote
Old 10-15-2013, 04:48 PM   #46
Superfreak04
FFR Veteran
FFR Veteran
 
Superfreak04's Avatar
 
Join Date: Jan 2007
Age: 33
Posts: 2,407
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Fission View Post
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.
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.
__________________
Superfreak04 is offline   Reply With Quote
Old 10-15-2013, 04:51 PM   #47
rushyrulz
Digital Dancing!
Retired StaffFFR Simfile AuthorFFR Music ProducerD7 Elite KeysmasherFFR Veteran
 
rushyrulz's Avatar
 
Join Date: Feb 2006
Location: 80 billion club, NE
Age: 31
Posts: 12,980
Default 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..
rushyrulz is offline   Reply With Quote
Old 10-15-2013, 04:54 PM   #48
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default 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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Old 10-15-2013, 04:57 PM   #49
Air En Trance
FFR Player
 
Air En Trance's Avatar
 
Join Date: Oct 2013
Posts: 17
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by rushyrulz View Post
I've had much harder assignments in introductory level classes. One of my projects was to code a sieve of eratosthenes from scratch.
isn't that just like a couple nested for loops? much easier than a bunch of awkward input handling
Air En Trance is offline   Reply With Quote
Old 10-15-2013, 04:58 PM   #50
Fission
no
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Fission's Avatar
 
Join Date: Jan 2004
Age: 33
Posts: 1,850
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Kibblre View Post
I used Java more than C++, so I don't know if there's a direct IO function to handle it. You could use getline() to take in the whole line and then use substr() to cut it down to the first character only and finally cast it as a char.
this is completely unnecessary. just use cin.get() (generically istream::get()) if you really want to do this.
Fission is offline   Reply With Quote
Old 10-15-2013, 04:58 PM   #51
Air En Trance
FFR Player
 
Air En Trance's Avatar
 
Join Date: Oct 2013
Posts: 17
Default Re: Requesting help for programming/ CS majors?

can someone explain clearly what the problem is asking
Air En Trance is offline   Reply With Quote
Old 10-15-2013, 05:00 PM   #52
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Fission View Post
this is completely unnecessary. just use cin.get() (generically istream::get()) if you really want to do this.
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Old 10-15-2013, 05:05 PM   #53
dAnceguy117
new hand moves = dab
FFR Simfile AuthorFFR Veteran
 
dAnceguy117's Avatar
 
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Fission View Post
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.
I think we all posted disclaimers. I assumed Superfreak is short on time.
dAnceguy117 is offline   Reply With Quote
Old 10-15-2013, 05:09 PM   #54
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default 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;
            }
        }
    }
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Old 10-15-2013, 05:10 PM   #55
justin_ator
🥓<strong><span style="col
Resident Overseer
FFR Veteran
 
justin_ator's Avatar
 
Join Date: Mar 2007
Location: Kingsport, TN
Posts: 7,648
Default 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
justin_ator is offline   Reply With Quote
Old 10-15-2013, 05:13 PM   #56
Fission
no
Simfile JudgeFFR Simfile AuthorFFR Veteran
 
Fission's Avatar
 
Join Date: Jan 2004
Age: 33
Posts: 1,850
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Kibblre View Post
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.
i know, i'm just saying that this is the preferred way to extract characters from an input stream

Quote:
Originally Posted by dAnceguy117 View Post
I think we all posted disclaimers. I assumed Superfreak is short on time.
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.
Fission is offline   Reply With Quote
Old 10-15-2013, 05:15 PM   #57
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Fission View Post
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.
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Old 10-15-2013, 05:16 PM   #58
dAnceguy117
new hand moves = dab
FFR Simfile AuthorFFR Veteran
 
dAnceguy117's Avatar
 
Join Date: Dec 2002
Location: he/they
Age: 33
Posts: 10,094
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by justin_ator View Post
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.
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...

but no one is here to judge

Quote:
Originally Posted by Fission View Post
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.
the "intro" solution would just be to make a huge static array, heh
dAnceguy117 is offline   Reply With Quote
Old 10-15-2013, 05:17 PM   #59
Superfreak04
FFR Veteran
FFR Veteran
 
Superfreak04's Avatar
 
Join Date: Jan 2007
Age: 33
Posts: 2,407
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Fission View Post
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.
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.
__________________
Superfreak04 is offline   Reply With Quote
Old 10-15-2013, 05:19 PM   #60
Kibblre
Caelondia Represent
FFR Veteran
 
Kibblre's Avatar
 
Join Date: Jul 2004
Location: A place of hearts and ghosts
Age: 31
Posts: 1,984
Default Re: Requesting help for programming/ CS majors?

Quote:
Originally Posted by Superfreak04 View Post
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.
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.
__________________
Какой идиот придумал Бутерброд с дикобраза? Он хулиган и бездельник.
Kibblre is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 08:45 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution