1. Post #1

    December 2012
    68 Posts
    I plan to start college this winter term and will start with CS161. My friend talked me out of taking CS161 and doing CS162 instead.
    I have previous experience in programming. Mostly C# but I have edit some C++ projects and done some coding.

    So I checked the content overview for both courses and content from CS161 seems too easy for someone with previous programming experience.
    Before I actually switch to CS162 I thought maybe I can get some assigments from similar college courses. If you have any, please share

    CS161 http://www.pcc.edu/schedule/default....&subtopicCode=
    CS162 http://www.pcc.edu/schedule/default....&subtopicCode=

    Edit:
    Some sample work I did from CS161 http://pastebin.com/yC0u9DLf
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Useful Useful x 1Agree Agree x 1 (list)

  2. Post #2
    A Self Condescending Title
    Xion12's Avatar
    October 2006
    2,207 Posts
    I go to a Junior college, but here is a simple one:
    Assignment 5.1

    Write a program that asks the user how many numbers will be entered and then has the user enter those numbers. When this is done, report to the user the position of the first 8 entered and the last 8 entered. By position we mean, for example, that if the first 8 is the 2nd number entered then its position would be 2. Turn in the following 3 outputs to demonstrate that your program works in each case.
    I lost the source code, but I think you can figure it out yourself.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 1 (list)

  3. Post #3
    Gold Member
    Neo Kabuto's Avatar
    November 2008
    5,641 Posts
    I remember from my CS2 class we had to write a stack class/struct and then implement reverse Polish notation with input of an unknown length from the console.

  4. Post #4

    December 2012
    68 Posts
    I go to a Junior college, but here is a simple one:
    I lost the source code, but I think you can figure it out yourself.
    I am derping big time over here. Not sure what is meant by " report to the user the position of the first 8 entered and the last 8 entered", even after reading example I still don't get it.
    I asked user for how many numbers he wants, then I ask for all the numbers while storing them in array.

  5. Post #5
    NovembrDobby's Avatar
    April 2007
    1,157 Posts
    I am derping big time over here. Not sure what is meant by " report to the user the position of the first 8 entered and the last 8 entered", even after reading example I still don't get it.
    I asked user for how many numbers he wants, then I ask for all the numbers while storing them in array.
    The wording is a bit odd. They want to know the index of the first '8' that the user entered, and the last '8' they entered. And I guess you have to print a message if they didn't enter any 8's.
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Informative Informative x 1 (list)

  6. Post #6
    A Self Condescending Title
    Xion12's Avatar
    October 2006
    2,207 Posts
    The assignment is simply to ask the user for how many numbers he/she will input. And then ask for the user to input those numbers one by one. There is no array needed for this assignment.

    The easy way to do this is with a loop that finds the first 8, and then another loop that finds the last 8. Store those two positions in separate integers, and then output it in the console.

  7. Post #7
    Gold Member
    Angus725's Avatar
    October 2010
    1,728 Posts
    I got some stuff for c if you want it.

  8. Post #8
    Cake like Lady Gaga
    Shadaez's Avatar
    December 2005
    16,013 Posts
    I got some stuff for c if you want it.
    well I'm assuming most of the assignments won't have anything that's really binding them to a single language, so it shouldn't matter.

  9. Post #9

    December 2012
    68 Posts
    What if user enters only one number '8'? Should I count it as first and last or only first?

  10. Post #10
    panthers4713's Avatar
    July 2010
    70 Posts
    Who cares you aren't turning this in, you're just seeing if you can do it or not.

  11. Post #11

    December 2012
    68 Posts
    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        int first8 = 0, last8 = 0, numbers, numberinput;
    
        cout << "How many numbers would you like to enter? ";
        cin >> numbers;
        cout << endl;
    
    
    
        for (int i = 1; i <= numbers;  i++)
        {
            cout << "Enter #" << i << ": ";
            cin >> numberinput;
            cout << endl;
    
            if (numberinput == 8)
            {
                if (first8 == 0)
                    first8 = i;
    
                if (first8 > 0)
                    last8 = i;
            }
        }
    
        if (first8 > 0)
        {
            cout << "First number 8 in position: " << first8 << endl;
        }
    
        if (last8 > 0)
        {
            cout << "Last number 8 in position: " << last8 << endl;
        }
    
        if (first8 == 0 && last8 == 0)
        {
            cout << "You have not entered number 8" << endl;
        }
    
        return 0;
    }
    Something like this? Still iffy about assigment

  12. Post #12
    Cake like Lady Gaga
    Shadaez's Avatar
    December 2005
    16,013 Posts
    What if user enters only one number '8'? Should I count it as first and last or only first?
    Well, it would be both, wouldn't it? And what if they don't put any 8s in?

    Edited:

    ah you accounted for it already

  13. Post #13
    Gold Member
    Angus725's Avatar
    October 2010
    1,728 Posts
    well I'm assuming most of the assignments won't have anything that's really binding them to a single language, so it shouldn't matter.
    http://db.tt/vzlAYZ0C

    The assignment is to teach memory allocation. malloc style.