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

Anybody good with C++?

Discussion in 'Off-Topic Discussion' started by jeckel7234, Sep 15, 2012.

  1. Sep 15, 2012 at 8:21 PM
    #1
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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,
    Is anybody here experienced with C++

    Im given the following values but what is the e all about in purple?

    color is 2
    black is 2.5
    crayon is -1.3
    straw is 1
    red is 3
    purple is 0.3e+1
     
  2. Sep 15, 2012 at 8:32 PM
    #2
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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,
    Mech Engineering,

    Its for a comp science class, and so far im having a lil trouble getting the jist of C ++
     
  3. Sep 15, 2012 at 8:43 PM
    #3
    krap22

    krap22 Well-Known Member

    Joined:
    Mar 20, 2011
    Member:
    #53389
    Messages:
    21,287
  4. Sep 15, 2012 at 8:46 PM
    #4
    MontanaTaco

    MontanaTaco Well-Known Member

    Joined:
    Mar 25, 2010
    Member:
    #33941
    Messages:
    878
    Gender:
    Male
    First Name:
    Colter
    Relocated to Albany, NY
    Vehicle:
    14 DCLB Sport
    OME lift
    I am a junior in ME but I've never heard of C++
     
  5. Sep 15, 2012 at 8:50 PM
    #5
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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,
    see i know it on a calculator as being raised to a ^10 power but i just dont know if its the same on C++ because im reading through the book (where i cant find a refrence to the e) and % represents almost the same thing as subtraction aparently
     
  6. Sep 15, 2012 at 8:52 PM
    #6
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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'm a sophmore, and maybe youve used MatLab, which ive used a little bit before and it seems very similar to that
     
  7. Sep 15, 2012 at 8:53 PM
    #7
    MontanaTaco

    MontanaTaco Well-Known Member

    Joined:
    Mar 25, 2010
    Member:
    #33941
    Messages:
    878
    Gender:
    Male
    First Name:
    Colter
    Relocated to Albany, NY
    Vehicle:
    14 DCLB Sport
    OME lift
    Ohhh yes good ol' matlab, yeah the e is like the big E on a calculator. Now why they have it like e+1 is beyond me, its really not needed.
     
  8. Sep 15, 2012 at 8:54 PM
    #8
    Rich91710

    Rich91710 Well-Known Member

    Joined:
    Feb 23, 2012
    Member:
    #73470
    Messages:
    16,331
    Gender:
    Male
    First Name:
    Rich
    Los Angeles
    Vehicle:
    08 Base
    Satoshi with FJ badge, factory cruise, factory intermittent wipers, Redline Tuning hood-lift struts, Hellwig Swaybar, Rosen DVD-Nav
    Gotta be something else, given that 0.3e+1 (scientific notation) translated to decimal is 0.0000059049
    Doesn't look like a color value.

    Edit....

    Screwed that one... the value is 3
     
  9. Sep 15, 2012 at 8:55 PM
    #9
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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,
    in matlab is the % sign represent what you would normally think of as a percenct of something
     
  10. Sep 15, 2012 at 8:55 PM
    #10
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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,
    Assume that you have the following variable declarations:

    int color, lime, straw, yellow, red, orange;
    float black, white, green, blue, purple, crayon;

    Evaluate each of the statements below given the following values:
    color is 2
    black is 2.5
    crayon is -1.3
    straw is 1
    red is 3
    purple is 0.3e+1
    Write your answer in the form: variable is assigned value

    white = color * 2.5 / purple;
    green = color / purple;
    orange = color / red;
    blue = (color + straw) / (crayon + 0.3);
    lime = red / color + red % color;
    purple = straw / red * color;
     
  11. Sep 15, 2012 at 8:56 PM
    #11
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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 the entire question
     
  12. Sep 15, 2012 at 8:58 PM
    #12
    TacomaChris

    TacomaChris Well-Known Member

    Joined:
    Sep 27, 2011
    Member:
    #64233
    Messages:
    377
    Gender:
    Male
    Sorry...I could school you in some Python or Java. I've only taken one C++ class but that was eons ago
     
  13. Sep 15, 2012 at 8:58 PM
    #13
    Rich91710

    Rich91710 Well-Known Member

    Joined:
    Feb 23, 2012
    Member:
    #73470
    Messages:
    16,331
    Gender:
    Male
    First Name:
    Rich
    Los Angeles
    Vehicle:
    08 Base
    Satoshi with FJ badge, factory cruise, factory intermittent wipers, Redline Tuning hood-lift struts, Hellwig Swaybar, Rosen DVD-Nav
    Consistency.

    It prevents the "e" from being confused as a variable.

    0.3e+1 is a different number than 0.3e-1
    0.3e+1 merely happens to be the even power of 10
     
  14. Sep 15, 2012 at 9:00 PM
    #14
    MontanaTaco

    MontanaTaco Well-Known Member

    Joined:
    Mar 25, 2010
    Member:
    #33941
    Messages:
    878
    Gender:
    Male
    First Name:
    Colter
    Relocated to Albany, NY
    Vehicle:
    14 DCLB Sport
    OME lift
    Well in matlab I would set this up but first defining the colors to those values, then write a simple code to do those multiplications/divisions.
    And the % does not mean percentage of something, I think its part of the coding to name what the program is going to do for you.
     
  15. Sep 15, 2012 at 9:01 PM
    #15
    jeckel7234

    jeckel7234 [OP] Well-Known Member

    Joined:
    May 12, 2011
    Member:
    #56533
    Messages:
    876
    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,

    so in any math enviroment when e is subtracted by 1, its to the negative 10th power. And if e has one added then it is to the positive 10th power?

    can it have a greater number added or subtract than 1?

    Thanks again
     
  16. Sep 15, 2012 at 9:10 PM
    #16
    MontanaTaco

    MontanaTaco Well-Known Member

    Joined:
    Mar 25, 2010
    Member:
    #33941
    Messages:
    878
    Gender:
    Male
    First Name:
    Colter
    Relocated to Albany, NY
    Vehicle:
    14 DCLB Sport
    OME lift
    Yes it is used a lot when the number is really big or small. Say you have .00045 which also can be wrote as 4.5E-4. The same for big numbers such as modulus of elasticity which are on the number of E+9 (GPa). Its pretty much saying how many zeroes are before or after the decimal
     
  17. Sep 15, 2012 at 9:15 PM
    #17
    Rich91710

    Rich91710 Well-Known Member

    Joined:
    Feb 23, 2012
    Member:
    #73470
    Messages:
    16,331
    Gender:
    Male
    First Name:
    Rich
    Los Angeles
    Vehicle:
    08 Base
    Satoshi with FJ badge, factory cruise, factory intermittent wipers, Redline Tuning hood-lift struts, Hellwig Swaybar, Rosen DVD-Nav
    Yes... the number after the "e" indicates the power.
    The "e(x)" replaces "*10^(x)"
    e+4 = *10^(4)
    e-4 = *10^(-4)
    e+100 = *10^(100) (BTW: That is a Google)
    e-100 = *10^(-100)
     
  18. Sep 15, 2012 at 9:19 PM
    #18
    Rich91710

    Rich91710 Well-Known Member

    Joined:
    Feb 23, 2012
    Member:
    #73470
    Messages:
    16,331
    Gender:
    Male
    First Name:
    Rich
    Los Angeles
    Vehicle:
    08 Base
    Satoshi with FJ badge, factory cruise, factory intermittent wipers, Redline Tuning hood-lift struts, Hellwig Swaybar, Rosen DVD-Nav
    I ran the calcs manually and ended up coming up with purple = orange.... and neither = 0.3e+1 (which we know purple=), so the correct answer does not appear to involve a simple mathematic solution using numerical substitution for known variables.


    But it's been about 30 years since I've used scientific notation or any calculus, and my most advanced programming experience is limited to dBase-III and QuickBasic.
     
  19. Sep 15, 2012 at 9:19 PM
    #19
    Boring

    Boring This space unintentionally left blank.

    Joined:
    Apr 27, 2010
    Member:
    #36129
    Messages:
    692
    Gender:
    Male
    Arizona
    Vehicle:
    5-lug regular cab
    yarp
    I've had C++, but it's been years.

    I think he/she wants you to plug those into a compiler and try and learn about order of operations and types. Note the two different types or integers and floating point. Doing math on mixed types will work, but it might not give you what you expect.

    The % is a math function for remainders. http://www.cprogramming.com/tutorial/modulus.html

    The 0.3e+1 is shorthand scientific notation for 0.3 x 10^1 which is 0.3, I think.

    Edit:
    http://codepad.org/gYsqDTGV
    I had to relearn printf. Long time ago.
     
  20. Sep 15, 2012 at 9:28 PM
    #20
    MontanaTaco

    MontanaTaco Well-Known Member

    Joined:
    Mar 25, 2010
    Member:
    #33941
    Messages:
    878
    Gender:
    Male
    First Name:
    Colter
    Relocated to Albany, NY
    Vehicle:
    14 DCLB Sport
    OME lift
    Yeah you're right I should have been more clear

    white = color * 2.5 / purple;
    green = color / purple;
    orange = color / red;
    blue = (color + straw) / (crayon + 0.3);
    lime = red / color + red % color;
    purple = straw / red * color;

    I would define the colors to the values given in the problem then ask the program to do these and see what it came up with.
    I am terrible at explaining things, especially over typing
     

Products Discussed in

To Top