Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: BEHOLD MY GREATNESS! (first complicated c++ program)

                  
   
  1. #11
    Registered User NoQuarter's Avatar
    Join Date
    Dec 2005
    Posts
    2,106
    Rep Power
    0

    Default

    So, are you gonna compile it for the psp?

  2. #12
    DCEmu Legend shadowprophet's Avatar
    Join Date
    May 2005
    Location
    IFeedOffYourFearS
    Age
    48
    Posts
    3,102
    Rep Power
    98

    Thumbs up

    Quote Originally Posted by Cap'n 1time View Post
    I have been taking a c++ class for about 2 weeks. Ive done some silly little things using the standard cpp libraries but nothing really complexed.

    Anyone whos taken a programming class will probably be familiar with this one. It is the Fibonacci program where you determine the nth number of the sequence. Mine has a slight twist however. The book wants me to use the sequence to determine how asexual things reproduce. In other words... basically you just multiply the initial value by the "final sum" which is actually just the place in the fibonacci sequence you determined.

    BEHOLD MY CODE!
    ---------------------------

    //Greatest program in the world.
    //By: Alan Gardner

    #include <iostream>
    using namespace std;

    int main()
    {
    int count;
    // long long is HUGE! alast and blast are initialized.
    long long alast, blast, sum, n;
    int totamnt;
    alast = 0;
    blast = 1;
    // Determines place in the sequence.
    cout << "Enter time: ";
    cin >> n;
    cout << "\n";
    // Determines inital amount (what to multiply final sum by).
    cout << "Enter total amount: ";
    cin >> totamnt;
    cout << "\n";
    switch (n)
    {
    // Catches 0 before it outputs a negative number.
    case 0: cout << "0"; break;
    // Catches 1 before it outputs 0.
    case 1: cout << 1 * totamnt; break;
    default:
    // Determines place in the sequence.
    for (count= 0; count < n-1; count++)
    {
    // "Rolls" numbers around to make the sequece work.
    sum = alast + blast;
    alast = blast;
    blast = sum;
    };
    // Outputs the place in the sequence multiplied by the initial ammount.
    cout << "\n" << sum * totamnt << " is the total amount."; break;
    }
    return 0;
    }

    -----
    Since there are no extra libraries, you should be able to just compile right away.
    Sweet

    It sure took you long enough we where talking about this stuff almost a year ago 1x Still your doing great, Ive all But given up codeing

  3. #13
    DCEmu Legend Cap'n 1time's Avatar
    Join Date
    May 2004
    Location
    Right behind you...
    Age
    37
    Posts
    4,547
    Rep Power
    121

    Default

    Quote Originally Posted by Darth Paul
    look at me being a $#@!!
    So do you say that about all the homebrew coded in c++? The games? Your operating system? This a beginning step for me and I'm quite proud of it. If you dont have anything valuable to add (such as praise for my greatness) or any advice than please... dont comment.

    Quote Originally Posted by NoQuarter View Post
    So, are you gonna compile it for the psp?
    somehow i dont think anyone will be interested in finding a value in the Fibonacci sequence on the go.

    Quote Originally Posted by SP
    Sweet

    It sure took you long enough we where talking about this stuff almost a year ago 1x Still your doing great, Ive all But given up codeing
    I learned visual basic last year which was fairly simple. This is my first experience with a REAL programming language.

  4. #14
    Registered User NoQuarter's Avatar
    Join Date
    Dec 2005
    Posts
    2,106
    Rep Power
    0

    Default

    Lol,I meant compile it for the psp for yourself as an exercise or fun.Didn't really mean for anybody else but you

  5. #15
    DCEmu Legend shadowprophet's Avatar
    Join Date
    May 2005
    Location
    IFeedOffYourFearS
    Age
    48
    Posts
    3,102
    Rep Power
    98

    Red face umm

    Quote Originally Posted by Cap'n 1time View Post
    So do you say that about all the homebrew coded in c++? The games? Your operating system? This a beginning step for me and I'm quite proud of it. If you dont have anything valuable to add (such as praise for my greatness) or any advice than please... dont comment.



    somehow i dont think anyone will be interested in finding a value in the Fibonacci sequence on the go.



    I learned visual basic last year which was fairly simple. This is my first experience with a REAL programming language.
    I was certain I was talking to you about c++ back then.

    I must be getting old my mind is sliping.

  6. #16
    Registered User NoQuarter's Avatar
    Join Date
    Dec 2005
    Posts
    2,106
    Rep Power
    0

    Default

    Either way congrats on your first real deal!
    Why for do you give up on programming shadowprophet?

  7. #17
    DCEmu Legend shadowprophet's Avatar
    Join Date
    May 2005
    Location
    IFeedOffYourFearS
    Age
    48
    Posts
    3,102
    Rep Power
    98

    Red face

    Quote Originally Posted by NoQuarter View Post
    Either way congrats on your first real deal!
    Why for do you give up on programming shadowprophet?
    Well it wasnt really like giving up, at first it was kinda like a challenge to me.
    But once I began to understand it. And comprehend how it works, It was kind of like I solved the puzzle, And I kinda moved on after that

    I can't resist a challenge

  8. #18
    Registered User NoQuarter's Avatar
    Join Date
    Dec 2005
    Posts
    2,106
    Rep Power
    0

    Default

    Right on,honestly I can understand that sentiment.Personally I'm just a bit OCD once I start,only prob with programming is that I haven't really started.I'm such a procrastinator(1 year's worth).

    I think I'm gonna bear down and really learn some stuff on this cycle though.

  9. #19
    DCEmu Legend Cap'n 1time's Avatar
    Join Date
    May 2004
    Location
    Right behind you...
    Age
    37
    Posts
    4,547
    Rep Power
    121

    Default

    Quote Originally Posted by shadowprophet View Post
    Well it wasnt really like giving up, at first it was kinda like a challenge to me.
    But once I began to understand it. And comprehend how it works, It was kind of like I solved the puzzle, And I kinda moved on after that

    I can't resist a challenge
    There is a lot more to c++ than just the standard libraries. There is plenty of challenge left for you.

  10. #20

    Default

    stdio for life!

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •