1. Welcome to Tacoma World!

    You are currently viewing as a guest! To get full-access, you need to register for a FREE account.

    As a registered member, you’ll be able to:
    • Participate in all Tacoma discussion topics
    • Communicate privately with other Tacoma owners from around the world
    • Post your own photos in our Members Gallery
    • Access all special features of the site

C++/Computer Programming

Discussion in 'Off-Topic Discussion' started by jeckel7234, Dec 6, 2012.

  1. jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    878
    Gender:
    Male
    First Name:
    Drew
    VA
    Vehicle:
    05 Tacoma
    Add-a-Leaf, Leveling Kit, 31.5 Nitto Grapplers, Mag-Lite Mod, Anit-Key in the ignition beep mod, Tail gate theft mod, Trifecta tonneau cover, washable cabin air filter,
    I would rather go to a Nicki Manaj concert with justin bieber, driving in a civic with a huge wing, wearing a polo (with collar popped), drinking a bud light, fitted turned to the side, and be raped by these people than ever do anything regarding c++ ever again.

    http://www.youtube.com/watch?feature=player_embedded&v=3zvTRQr7ns8


    any professionals with c++ trying to help a bro out?
     
  2. yarik83

    yarik83 Well-Known Member

    Joined:
    May 29, 2010
    Member:
    #38026
    Messages:
    218
    Gender:
    Male
    First Name:
    Yuri
    Florida
    Vehicle:
    2008 TRD SR5 DoubleCab 4x4
    Right now truck is stock. Bought it used but planning a mountain bike rack, tow ball thingie and some sort of truck bed cover
    When I first went to college I was going to be a computer engineer. About 2nd year into it... after taking visual basic, java, c, c++, fortran... I quit trying and switched a different career field.

    What happened to me was an atrocity. I was there to learn... everyone else was there to get credits because they were programming since age 4.

    Computer programming language is about second most stupid thing that happened to computers. Every computer language is slightly different and they all have to be debugged and all it would take is missing one character somewhere and a space there and a quotation or asterisk there and pow... entire thing does not work.

    I make my living using other people's code now. People right scripts which work with software packages I am using and that is so much easier.

    Stay strong my friend.
     
  3. Evil Monkey

    Evil Monkey There's an evil monkey in my truck

    Joined:
    Aug 8, 2007
    Member:
    #2352
    Messages:
    8,388
    Gender:
    Male
    First Name:
    Robert
    Escondido, CA
    Vehicle:
    07 4x4 DC SR5 TRD Off-road
    Weathertech front & rear mats, rear suspension TSB, Toytec AAL for TSB, Hi-Lift Jack, Bilstein 5100 & Toytec Adjustable coilovers, Built Right UCAs, KMC XD 795 Hoss Wheels, Definity Dakota MTs 285/75R16, Leer XR, Thule Tracker II & Thule MOAB basket
    Huh??!! :confused:
    I don't know how you'd get a computer to do anything without computer programming. Ever tried programming a computer with ones and zeros? Programming languages make it easier.
     
  4. Evil Monkey

    Evil Monkey There's an evil monkey in my truck

    Joined:
    Aug 8, 2007
    Member:
    #2352
    Messages:
    8,388
    Gender:
    Male
    First Name:
    Robert
    Escondido, CA
    Vehicle:
    07 4x4 DC SR5 TRD Off-road
    Weathertech front & rear mats, rear suspension TSB, Toytec AAL for TSB, Hi-Lift Jack, Bilstein 5100 & Toytec Adjustable coilovers, Built Right UCAs, KMC XD 795 Hoss Wheels, Definity Dakota MTs 285/75R16, Leer XR, Thule Tracker II & Thule MOAB basket
    I know some. What's the issue?
     
  5. yarik83

    yarik83 Well-Known Member

    Joined:
    May 29, 2010
    Member:
    #38026
    Messages:
    218
    Gender:
    Male
    First Name:
    Yuri
    Florida
    Vehicle:
    2008 TRD SR5 DoubleCab 4x4
    Right now truck is stock. Bought it used but planning a mountain bike rack, tow ball thingie and some sort of truck bed cover
    If you learn computer programming language without paying $258/credit hour and learn it at your own leisure then you have nothing to worry about. If you are attending college full time, work full time, juggle homework and all that stuff and you are the only person in your class of 300 that actually needs to learn... you are in for a treat.

    Do I think that computer language is necessary? Absolutely. Heck I use it daily at work in some capacity... but there is a significant disparity between syntax of programming languages. If you are learning for the first time try and learn Java, C++ at the same time and see how fun that experience will become. Both languages are essentially the same but ohh so much different. C++ flows with logic and simplicity while Java evokes feeling of "why is it.... ohh it can't possibly be the issue... doh... I missed a character".

    Basic of programming is all about logic. You set your environment, set variables and parameters, write some call commands and then deeper you get into it... its pulling this script from here, that code from there, this command from there. But problem is that when you have to learn all that in a limited time frame under pressure of failure... learning programming will be a pain.

    In my college flunk out rate for programming was pretty substantial. Every class started with 100-300 students in auditoriums then proceeded with 30 students in a class environment. Halfway through semester.... most of auditorium was empty.

    But I am heavily biased because of my experiences so take my advise with a grain of salt.

    90% of your errors are syntax.
    9% of your errors are calling on a code/command/script that does not exist
    1% of your errors are usually failure in logic.

    Most of the time you know what needs to be done and how to do it and you write the code and it wont work... 3 days later with debugging it still wont work and then you run it on another machine and it runs like a champ. Or better yet... you make it run on your machine... submit code for review and it wont run on TA's or professors computer.

    Tough luck eh?

    I use VB and SQL on a daily basis because of how ArcMap works and rely on scripts too. I recently in past 2 years started learning python on my own time. And it is so much easier learning it on your own time.... not even funny.

    P.S.
    #1 problem with computer programming (since I already mentioned #2) is failure of debug software to clear out the error state. You make an error, debug, fix the error and it still crashes... reboot computer and pow that sucker runs like a champ. True story.
     
  6. Pchop

    Pchop Beavis Killer

    Joined:
    Sep 17, 2012
    Member:
    #87171
    Messages:
    10,368
    Gender:
    Male
    First Name:
    Rob I
    South FL
    Vehicle:
    '09 Tacoma TRD
    I stumbled into the wrong post. Reading this is like watching a Charlie Brown episode to me:
    "Wah wa wah wah wa waa wah"

    Hats off to you guys, I would rather try and learn fucking Vietnamese than try and decipher that shit.
    But then again you guys probably couldnt manage a 400 person construction site so I guess we are even :D
     
  7. 04LTtacoma

    04LTtacoma Well-Known Member

    Joined:
    May 15, 2010
    Member:
    #37190
    Messages:
    11,144
    Gender:
    Male
    Vehicle:
    2004 SR5 TRD tacoma
    Camburg LT
    Well, at least you are done with programming... I got a few program classes I have to take as well, not looking forward to it.
     
  8. zbaldo

    zbaldo Well-Known Member

    Joined:
    Feb 10, 2012
    Member:
    #72550
    Messages:
    436
    Gender:
    Male
    First Name:
    Ozzy
    Torrance, Ca
    Vehicle:
    99 4Runner SR5 4X4
    Stock as Stock can be with duratracs and a roof rack
    Everybody is good at something right.
    God luck
    I know a guy that worked stocks and such after years of work he went bald
     
  9. Pchop

    Pchop Beavis Killer

    Joined:
    Sep 17, 2012
    Member:
    #87171
    Messages:
    10,368
    Gender:
    Male
    First Name:
    Rob I
    South FL
    Vehicle:
    '09 Tacoma TRD
    Not going bald, just greying out like a boss:|
     
  10. rondog

    rondog your TW web developer!

    Joined:
    Nov 2, 2010
    Member:
    #45618
    Messages:
    2,031
    Gender:
    Male
    First Name:
    Ronnie
    Escondido/San Diego
    Vehicle:
    pewp
    Total Chaos LT, 2.5x8" Fox coilover, 2.5x8" Fox triple bypass, GIANT SUA rear LT, 2.5x18" Fox triple bypass, 285/70/17 Toyo AT2, Glassworks all around, 4x Eagle Eye HIDs
    what are you trying to do in c++? I know quite a few languages and might be able to help.
     
  11. ChamYota

    ChamYota AKA Crash Bandicoot

    Joined:
    Jul 6, 2011
    Member:
    #59431
    Messages:
    8,206
    Gender:
    Male
    First Name:
    Cam
    Clemson,South Carolina
    Vehicle:
    05 PreRunner AND 82' Toyota P/U 4wd
    H1 Morimoto projector with XB35 4300K bulbs with Mini-gatling gun shrouds, BHLM. Debadged,OEM roof rack,TW sticker,Sockmonkey Beside decals,265/70/16 Nitto terra grapplers with dick cepek DC'2 wheels,weathertech floor liners(front/back),USA Spec Ipod reader,Scanguage II,Bestop Supertopper and more in the works...
    Im a Computer Science major(BS) at Clemson, and so far, im pretty much enjoying it, yes the frustration that comes from missing just one character is pretty epic, but for the most part, the possibilities are sickening and the pay will be as well.
     
  12. jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    878
    Gender:
    Male
    First Name:
    Drew
    VA
    Vehicle:
    05 Tacoma
    Add-a-Leaf, Leveling Kit, 31.5 Nitto Grapplers, Mag-Lite Mod, Anit-Key in the ignition beep mod, Tail gate theft mod, Trifecta tonneau cover, washable cabin air filter,
    Im not done yet, i only have one class that involves c++ i should be using matlab the rest of the way. Im working on a project which is driving me a little crazy, its like a constant mental block, every thing im reading or watching on youtube about it is getting me nowhere. If anybody cares/wants to help I would be extremely greatful.


    Problem
    For this problem, you will design and implement 2 classes and then write a driver function to test these classes. The first will be a C++ class for an abstract data type color with a public enumeration type colorType that has the color values shown in Listing 10.8. Your abstract data type should have an attribute for storing a single value of type colortype and member functions for reading (readColor) and writing (writeColor) a color value as well as setting and accessing it. The function readColor should read a color as a string and store the corresponding color value in the value attribute of a type color object. The function writeColor should display as a string the value stored in the value attribute of a type color object (see Figure 7.5). Modify class circle and the driver function in Listing 10.9 to include and use this class. You’ll need to remove the declaration for color in class circle. Test your modified driver function with the new color and circle classes.

    The second class will be to design and implement a rectangle class similar to class circle. Be sure to incorporate the new color class you have written and tested in the first part of the programming exercise. Write a client program that asks the user to enter a shape name (circle or rectangle) and then asks the user for the necessary data for an object of that class. The program should create the object and display all its attributes.
     
  13. jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    878
    Gender:
    Male
    First Name:
    Drew
    VA
    Vehicle:
    05 Tacoma
    Add-a-Leaf, Leveling Kit, 31.5 Nitto Grapplers, Mag-Lite Mod, Anit-Key in the ignition beep mod, Tail gate theft mod, Trifecta tonneau cover, washable cabin air filter,
    This is what I have so far

    circletest.cpp
    #include "circle.h"
    #include <iostream>
    using namespace std;

    int main()
    {
    circle myCircle(10);
    float area, perimeter;

    // Set circle attributes.
    myCircle.setCoord(150, 100);
    myCircle.setColor(circle::magenta);

    // Compute area and perimeter
    area = myCircle.computeArea();
    perimeter = myCircle.computePerimeter();

    // Display the circle attributes.
    cout << "The circle attributes follow:" << endl;
    myCircle.displayCircle();

    // Display area and perimeter.
    cout << "area is " << area << endl;
    cout << "perimeter is " << perimeter << endl;

    return 0;
    }




    circle.h
    #ifndef CIRCLE_H
    #define CIRCLE_H

    class circle
    {
    public:
    // enumeration type
    enum color {black, blue, green, cyan, red,
    magenta, brown, lightgray, nocolor};

    // Member Functions
    // constructor
    circle(int);

    // Set center coordinates
    void setCoord(int, int);

    // Set radius
    void setRadius(int);

    // Set color
    void setColor(color);

    // Compute the area
    float computeArea();

    // Compute the perimeter
    float computePerimeter();

    // Display attributes
    void displayCircle() const;

    // accessor functions
    int getX() const;
    int getY() const;
    int getRadius() const;
    color getColor() const;


    private:
    // Data members (attributes)
    int x;
    int y;
    int radius;
    color cColor;

    };

    #endif // CIRCLE_H




    circle.cpp
    #include "circle.h"
    #include <iostream>
    using namespace std;

    const float pi = 3.14159;

    // Member Functions...
    // constructor
    circle::circle(int r)
    {
    x = 0;
    y = 0;
    radius = r;
    cColor = nocolor;
    }

    // Set center position
    void circle::setCoord(int xArg, int yArg)
    {
    x = xArg;
    y = yArg;
    }


    // Set radius
    void circle::setRadius(int r)
    {
    radius = r;
    }


    // Set color
    void circle::setColor(color c)
    {
    cColor = c;
    }


    // Compute the area
    float circle::computeArea()
    {
    return pi * radius * radius;
    }


    // Compute the perimeter
    float circle::computePerimeter()
    {
    return 2 * pi * radius;
    }


    // Display attributes
    void circle::displayCircle() const
    {
    cout << "x-coordinate is " << x << endl;
    cout << "y-coordinate is " << y << endl;
    cout << "radius is " << radius << endl;
    cout << "color is " << int(cColor) << endl;

    }


    // accessor functions
    circle::color circle::getColor() const
    {
    return cColor;
    }

    // Insert definitions for rest of accessor functions here.
    // ...

    int circle::getX() const
    { return x;
    }

    int circle::getY() const
    { return y;
    }

    int circle::getRadius() const
    { return radius;
    }
     
  14. jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    878
    Gender:
    Male
    First Name:
    Drew
    VA
    Vehicle:
    05 Tacoma
    Add-a-Leaf, Leveling Kit, 31.5 Nitto Grapplers, Mag-Lite Mod, Anit-Key in the ignition beep mod, Tail gate theft mod, Trifecta tonneau cover, washable cabin air filter,
    ^ I've gotten that far with random help from the teacher and talking to my buddys brother over facebook. I'm just lost on were to go now after I have the 2 original functions and a driver function
     
  15. Evil Monkey

    Evil Monkey There's an evil monkey in my truck

    Joined:
    Aug 8, 2007
    Member:
    #2352
    Messages:
    8,388
    Gender:
    Male
    First Name:
    Robert
    Escondido, CA
    Vehicle:
    07 4x4 DC SR5 TRD Off-road
    Weathertech front & rear mats, rear suspension TSB, Toytec AAL for TSB, Hi-Lift Jack, Bilstein 5100 & Toytec Adjustable coilovers, Built Right UCAs, KMC XD 795 Hoss Wheels, Definity Dakota MTs 285/75R16, Leer XR, Thule Tracker II & Thule MOAB basket
    So the problem looks like it is asking you to create a separate abstract class for the color (an abstract class has one or more pure virtual functions in it). The circle class would then inherit that abstract color class. The way it is listed, the circle class is implementing the color which is not what you want. They're trying to teach inheritance and common interfaces. So your color class can be used in the rectangle class without modifying it or doing a cut-n-paste from one code section to the next.


    So you'll need another class with one or more pure virtual functions (to make it an abstract class) and inherit that class into your circle/rectangle classes.

    http://www.learncpp.com/cpp-tutoria...-abstract-base-classes-and-interface-classes/

    In the example above, your Color class would be similar to the "Animal" class and your circle and rectangle class would be similar to how the cow class is implemented.
     
To Top