C++ help please!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vash02
    Shut your face
    • May 2002
    • 671

    #1

    C++ help please!

    Okay i need help from you smart people out there. I need a complete c++ program for the following problem.

    Write a complete program to produce a chart consisting of the multiples of 5 from -50 to 50 together with the squares and cubes of these numbers. Use a function to print a suitbale heading and user-defined functions for square and cube.


    Thanks alot. Im in my second qrt. of this stuff and this one is driving me nuts.
  • gimp
    Registered User
    • Jan 2001
    • 2368

    #2
    well, i'll give you some ideas of how I'd do it. It's just pseuodocode, but you get the idea.



    ********************main function
    print("number squared cubed")

    for i = -10 to 10
    num = i*5;
    print(num, square(num), cube(num) )
    end for loop




    *******************square function***********
    int square(x)
    return (x*x);

    *******************cube function************
    int cube(x)
    return (x*x*x)

    Comment

    • Kevmaster
      Owners Group Div: Director
      • Oct 2001
      • 5475

      #3
      or not psuedo code:

      #include <iostream>
      using namespace std;

      int main() {
      -for (int a = -50; a < 50; a+=5) {
      --cout << "Number: "<< a ;
      --cout << ", Square: " << (a*a);
      --cout << ", Cube: " << (a*a*a) ;
      --cout << endl;

      -}
      }


      the "-" and "--" represent indentations
      the actaul headers and main declaration may vary based on your compiler, Im using Metroworks Code Warrior

      Comment

      • Vash02
        Shut your face
        • May 2002
        • 671

        #4
        Thanks alot to the both of you...i may need to call upon you again in the future.

        Comment

        • impostal22
          disgruntled...
          • Apr 2003
          • 1623

          #5
          is this c++ course in highschool or college? just curious.

          Comment

          • Kai

            #6
            Jeff, you lazy piece of crap.

            Now you are only behind, what...16 assignments?

            Comment

            • Vash02
              Shut your face
              • May 2002
              • 671

              #7
              Its not that im lazy..i hoestly dont understand this program.

              And by the way ryan..........im only down 14!!

              P.S. this is a high school course..and i hate it. Im not cut out for programming.

              Comment

              • Vash02
                Shut your face
                • May 2002
                • 671

                #8
                By the way, i noticed your back to the lennon sig ryan.

                Comment

                • Brak
                  POOP
                  • Sep 2002
                  • 1996

                  #9
                  Originally posted by Vash02
                  By the way, i noticed your back to the lennon sig ryan.

                  off subject, but itsnt he lennin? i chose stalin over him for a report...
                  SIG RULES SUCK REAL BAD AND THEYRE STUPID AND DUMB AND THEY STINK AND ARE STUPID AND I HATE THEM AND THEY SUCK REAL BAD

                  Comment

                  • pbzmag
                    Registered User
                    • Feb 2002
                    • 1468

                    #10
                    Originally posted by Vash02
                    P.S. this is a high school course..and i hate it. Im not cut out for programming.
                    Is it an elective class? I took Pascal in my Junior year as this was the only programming class offered. Personnally, I found programming easy to understand. For some people, it comes easy for them and for other's, it takes time for them to have it hit them on the side of the head to finally understand the logic. I took CIS in college and there were a few people who didn't understand the logic until the the 3rd year. Most classes were in DOS and legacy systems and 2 were Windows based. If you're thinking about a career in computers, hang in there. You'll have a small advantage over others who have gone into it, with no knowledge, for the high salary. Heck, I didn't even get a job doing programming. I went for pc/network support.

                    Comment

                    • impostal22
                      disgruntled...
                      • Apr 2003
                      • 1623

                      #11
                      i took a course in C++ last year (my junior year in high) and now i'm taking a college level c++ course in my senior year, and i really like it. problem is, i dunno what the hell i'm gonna do w/ the programming talent i have, because from what i hear the need for programmers/etc isn't what it used to be...

                      Comment

                      Working...