Page 1 of 2 12 LastLast
Results 1 to 25 of 29

Thread: C++ visual studio 2010 : hellpppp

  1. #1
    Jr Member blackmica10's Avatar
    Join Date
    Jul 2010
    Location
    maple
    Posts
    354
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default C++ visual studio 2010 : hellpppp

    i know its the shot in the dark on the forum but what the hell, i figure at least ONE of the asians on the board is a programmer....so i have a programming class at school and the final project is to make an atm. the entire thing works except for option c: that states add interest into your account. a number is returned, but its an insane number. for example if i compound 500$ at 1 year for 5% it gives out like 803333 dollars.... so if anyones good at accounting and programming help?

    code right now is :
    if(m==1)
    {
    printf("you are in chequings");
    printf("\nplease enter the amount of years you would like to compound for");
    scanf("%f",&years);
    printf("\nplease enter your interest rate");
    scanf("%f",&interest);
    if(newbalcheq>=5000)
    {
    for(i=1; i<= years*12; i=i++);
    newbalance=((interest/12)*newbalcheq);
    return(newbalance);
    fflush(stdin);
    getchar();
    }

    newbalcheq is the amount in the chequings account, and newbalance is SUPPOSE to be the amount of money your left with
    BLACK 05 HATCH

    AE grill & AE front bumper, eyelids,6000k hids, lowered on pro-kits, tenzo-r dc-5 17" with red vinyl lip, license plate leds, relocated front plate, gv front lip, visual garage sharkfin antenna, rally armor mudflaps, alpine sound system, interior leds, carbon fiber wrapped interior and many nextmod goodies!
    Quote Originally Posted by Default User View Post
    The MZ3 is for us poorer people that just wanna go somewhere reasonably quickly.

  2. #2
    Newbie steve220s's Avatar
    Join Date
    Jul 2008
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    I haven't programed in years, but it seems as though you're not dividing the interest (%) by 100 before multiplying with the number of years.

  3. #3
    Jr Member
    Join Date
    Jul 2005
    Posts
    320
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    This might be a stupid question. But are you compounding on an annual basis or on a monthly basis?
    06 Mazda 6 Sport - Tungsten Grey Metallic w/ GFX and Sport Package

    Homeland Security Terror Alert Level

  4. #4
    Sr Member Iceman_F1's Avatar
    Join Date
    Jun 2008
    Location
    Oakville
    Posts
    3,172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Never done C++ but if I'm reading this right, you enter years which is 1...you enter interest rate which is 5...I'm not sure what your loop is looping through (I do VB not C++) but you have newbalance= interest/12*newbalcheq...so interest/12 = 0.416..that * 500 = 208 in interest alone? I agree with steve220s though...I believe you aren't taking the interest and / by 100 to get the % form...
    2008.5 GT Sport - Black Mica - SOLD!
    2007 Mazdaspeed3 - Black Mica - Minor Mods

  5. #5
    Newbie hastiej's Avatar
    Join Date
    Sep 2010
    Location
    London, On
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Well first thing I see if your newbalchq is acutally listed as 5000, not 500... might explain the bloated number your getting. But I also have't used C++.. sorry man


    Quote Originally Posted by blackmica10 View Post
    i know its the shot in the dark on the forum but what the hell, i figure at least ONE of the asians on the board is a programmer....so i have a programming class at school and the final project is to make an atm. the entire thing works except for option c: that states add interest into your account. a number is returned, but its an insane number. for example if i compound 500$ at 1 year for 5% it gives out like 803333 dollars.... so if anyones good at accounting and programming help?

    code right now is :
    if(m==1)
    {
    printf("you are in chequings");
    printf("\nplease enter the amount of years you would like to compound for");
    scanf("%f",&years);
    printf("\nplease enter your interest rate");
    scanf("%f",&interest);
    if(newbalcheq>=5000)
    {
    for(i=1; i<= years*12; i=i++);
    newbalance=((interest/12)*newbalcheq);
    return(newbalance);
    fflush(stdin);
    getchar();
    }

    newbalcheq is the amount in the chequings account, and newbalance is SUPPOSE to be the amount of money your left with

    ***2008 GT Hatch CWP***
    MS3 Gen1 Rims black, Eye lids, 20% tint, stubby antenna

  6. #6
    Jr Member prinsesa's Avatar
    Join Date
    Feb 2010
    Posts
    962
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Can anyone help me with my Physics assignment?
    P R I N S E S A

    My cutie patootie: Mazda3 GX 2010.

  7. #7
    Sr Member SilentJay's Avatar
    Join Date
    Apr 2007
    Posts
    5,326
    Thanks
    4
    Thanked 68 Times in 55 Posts
    Mentioned
    47 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Ah memories... Wait, why is an ATM asking what interest rate to pay?

    If you ever end up working for an ATM manufacturer, let me know... "Interest rate? 1000000%."

  8. #8
    Sr Member SilentJay's Avatar
    Join Date
    Apr 2007
    Posts
    5,326
    Thanks
    4
    Thanked 68 Times in 55 Posts
    Mentioned
    47 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by prinsesa View Post
    Can anyone help me with my Physics assignment?
    Boo physics. Do my Stats, and i'll consider physics

  9. #9
    Newbie hastiej's Avatar
    Join Date
    Sep 2010
    Location
    London, On
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp



    Quote Originally Posted by prinsesa View Post
    Can anyone help me with my Physics assignment?

  10. #10
    Sr Member Iceman_F1's Avatar
    Join Date
    Jun 2008
    Location
    Oakville
    Posts
    3,172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by SilentJay View Post
    Ah memories... Wait, why is an ATM asking what interest rate to pay?

    If you ever end up working for an ATM manufacturer, let me know... "Interest rate? 1000000%."
    Good question

  11. #11
    Jr Member prinsesa's Avatar
    Join Date
    Feb 2010
    Posts
    962
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Sorry to hijack the thread!!! lol
    Last edited by prinsesa; 11-24-2010 at 03:59 PM.

  12. #12
    Sr Member Iceman_F1's Avatar
    Join Date
    Jun 2008
    Location
    Oakville
    Posts
    3,172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    In theory, I guess in a perfect vacuum, it could go faster than the speed of light...but how does it get to that speed in the first place? It starts off at a set speed, I would assume not faster than the speed of light, and the only way it could get to the speed is constant acceleration. But it doesn't have that...unless there was a massive amount of force/explosion that would trigger the movement of gas...and even then, it's hard to imagine anything that could propel gas to that speed...

    Though I have no clue...just bored at work and this gives me something to type out lol
    Last edited by cwp_sedan; 11-25-2010 at 11:00 AM. Reason: requested removal of quote

  13. #13
    Jr Member
    Join Date
    Jul 2005
    Posts
    320
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    well, for one the for loop will loop to number of years * 12 but because the loop is all to itself and its variables are not beings used anywhere else, its pretty much pointless.

    i'm also not sure as to where you're getting 80333 from because if i run thru your calculation this is what i get
    (5/12)*500 = 208.3333333

    but if you do it like steve220s says where you need to divide the interest by 100 to convert it to actual decimal, you get
    ((5/100)/12)*500 = 2.0833333

  14. #14
    Member
    Join Date
    Apr 2010
    Location
    Tri-City
    Posts
    1,349
    Thanks
    27
    Thanked 163 Times in 73 Posts
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    looks like you are assuming that the interest is compounded MONTHLY thus the "year*12" gets your number of months. The rate to compound PER MONTH = rate PER YEAR / 12. So when you do your loop it should be like so:

    (for int x= 0; x < (year*12); x++){
    newbalance = newbalance * (1+ rate-per-month)
    }
    print(newblance);

    like people have said, if you take in the yearly interest as a percent, you need to divide by 100 and then divide by 12.

    You can also look for a formula that calculates compound interest instead of using loops.

  15. #15
    Newbie steve220s's Avatar
    Join Date
    Jul 2008
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by blackmica10 View Post
    i know its the shot in the dark on the forum but what the hell, i figure at least ONE of the asians on the board is a programmer....so i have a programming class at school and the final project is to make an atm. the entire thing works except for option c: that states add interest into your account. a number is returned, but its an insane number. for example if i compound 500$ at 1 year for 5% it gives out like 803333 dollars.... so if anyones good at accounting and programming help?

    code right now is :
    if(m==1)
    {
    printf("you are in chequings");
    printf("\nplease enter the amount of years you would like to compound for");
    scanf("%f",&years);
    printf("\nplease enter your interest rate");
    scanf("%f",&interest);
    if(newbalcheq>=5000)
    {
    for(i=1; i<= years*12; i=i++);
    newbalance=((interest/12)*newbalcheq);
    return(newbalance);
    fflush(stdin);
    getchar();
    }

    newbalcheq is the amount in the chequings account, and newbalance is SUPPOSE to be the amount of money your left with
    If you ask me, this is what your program should do:
    Ask for the existing balance, set to existingbalance
    Ask for the interest rate or define this value without asking the user to do so, set as rate
    Ask for the amount of years of interest to add to the existing balance, set to years
    Then,
    newbalance = existingbalance * (1 + rate/100)^years
    this will calculate the new balance at the end of x amount of years chosen by the user assuming the interest is only compounted once annually. Very simple system which isn't really representative of banks but whatev...
    If you want to make the program a little better, ask for the amount of months rather than years. Than take the rate, divide by 12 (for the amount of months in a year) and then divide by 100 (because it's a percentage), the formula becomes:
    newbalance = existingbalance * (1 + ((rate/12)/100))^months
    This is essentially the same program but the interest is compounted monthly which is how banks work.
    The program will essentially show the user what his balance would be after x months with a certain interest rate by starting with an initial principal chosen himself.

  16. #16
    Jr Member blackmica10's Avatar
    Join Date
    Jul 2010
    Location
    maple
    Posts
    354
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    thanks for all the help guys, and dont ask me why it adds interest in an atm lmao its the project. also the outline states that you must ask for years compounded but calaculate in months.

  17. #17
    Sr Member n00bMeiSter's Avatar
    Join Date
    Aug 2009
    Posts
    7,253
    Thanks
    62
    Thanked 64 Times in 22 Posts
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Kinda late, but did you get this fixed?
    C++ is my bitch, even though I'm stuck doing crappy vb right now.

    What is newbalancecheq declared as? int, float, double?

    for(i=1; i<= years*12; i=i++);
    this is doing absolutely nothing, save for incrementing i, but you never used i or the loop. waste of time and memory.

    newbalance=((interest/12)*newbalcheq);
    like everyone else has said, you need to turn rate into a yearly percentage, and then divide by 12 to get monthly. you also need to remember that every month, when you add the interest, the next month you need to be calculating interest on the new amount in chequing, not the original amount.

    for(i=1; i<= years*12; i++)
    {
    newbal = newbal * (1+((rate/100)/12))
    }

    Also:
    scanf("%f",&years);
    should be using %d unless you are going to let the user enter 1.5 years. in which case you need to do extra calculations to turn, ie 1.2 years, into 14 months.
    Last edited by n00bMeiSter; 11-26-2010 at 11:51 AM. Reason: typo
    Warning!!!
    A STAGE#5 POST WHORE IN TRAINING...


    2004 GT Arctic White :: Manual 2.3 ::
    SRI | HID | Moustache

  18. #18
    Sr Member Iceman_F1's Avatar
    Join Date
    Jun 2008
    Location
    Oakville
    Posts
    3,172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by n00bMeiSter View Post
    Kinda late, but did you get this fixed?
    C++ is my bitch, even though I'm stuck doing crappy vb right now.

    What is newbalancecheq declared as? int, float, double?

    for(i=1; i<= years*12; i=i++);
    this is doing absolutely nothing, save for incrementing i, but you never used i or the loop. waste of time and memory.

    newbalance=((interest/12)*newbalcheq);
    like everyone else has said, you need to turn rate into a yearly percentage, and then divide by 12 to get monthly. you also need to remember that every month, when you add the interest, the next month you need to be calculating interest on the new amount in chequing, not the original amount.

    for(i=1; i<= years*12; i++)
    {
    newbal = newbal * (1+((rate/100)/12))
    }

    Also:
    scanf("%f",&years);
    should be using %d unless you are going to let the user enter 1.5 years. in which case you need to do extra calculations to turn, ie 1.2 years, into 14 months.
    Hey, nothing wrong with VB!

    But as for the loop, maybe the code is larger than what he listed and he only listed the relevant info? I know I do that instead of listing all the code as there's no need to list everything that has nothing to do with the problem part.

    Hopefully the advice helped you. Didn't realize this many people were programmers

  19. #19
    Sr Member n00bMeiSter's Avatar
    Join Date
    Aug 2009
    Posts
    7,253
    Thanks
    62
    Thanked 64 Times in 22 Posts
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by Iceman_F1 View Post
    Hey, nothing wrong with VB!

    But as for the loop, maybe the code is larger than what he listed and he only listed the relevant info? I know I do that instead of listing all the code as there's no need to list everything that has nothing to do with the problem part.

    Hopefully the advice helped you. Didn't realize this many people were programmers
    That's like saying American is a language. It's just a bastardization of a real langauge! and for those who can't speak (read: program) lol (j/k)
    VB has some nice ideas, I'll give it that much. But on a whole, it's just not powerful enough. If I can't volatile some ASM / machine language in, I might as well go feed the ducks (okay, so that's an extreme example).

    VB just doesn't give me the same kind of control that c++ does. However, the OOP and OM heirarchy of VB is nice. And For Each is awesome.

  20. #20
    Sr Member Iceman_F1's Avatar
    Join Date
    Jun 2008
    Location
    Oakville
    Posts
    3,172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by n00bMeiSter View Post
    That's like saying American is a language. It's just a bastardization of a real langauge! and for those who can't speak (read: program) lol (j/k)
    VB has some nice ideas, I'll give it that much. But on a whole, it's just not powerful enough. If I can't volatile some ASM / machine language in, I might as well go feed the ducks (okay, so that's an extreme example).

    VB just doesn't give me the same kind of control that c++ does. However, the OOP and OM heirarchy of VB is nice. And For Each is awesome.
    I guess VB works well enough for us then. I find no issues with it...then again never worked with C++ before so can't judge. We've done some interesting stuff in VB...guess it's whatever works for each person to do what you need to do.

  21. #21
    Sr Member n00bMeiSter's Avatar
    Join Date
    Aug 2009
    Posts
    7,253
    Thanks
    62
    Thanked 64 Times in 22 Posts
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by Iceman_F1 View Post
    I guess VB works well enough for us then. I find no issues with it...then again never worked with C++ before so can't judge. We've done some interesting stuff in VB...guess it's whatever works for each person to do what you need to do.
    Yup, to each his own. What do you guys do with it? What interesting things have you guys managed to do with it?
    If you're going to be interacting with Office products, for sure VB is probably your best bet. Or if you're in a huge hurry and only have time to basically drag and drop.

  22. #22
    Sr Member Iceman_F1's Avatar
    Join Date
    Jun 2008
    Location
    Oakville
    Posts
    3,172
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by n00bMeiSter View Post
    Yup, to each his own. What do you guys do with it? What interesting things have you guys managed to do with it?
    If you're going to be interacting with Office products, for sure VB is probably your best bet. Or if you're in a huge hurry and only have time to basically drag and drop.
    Our main use is tracking info throughout the shop (Kitchen Manufacture)...so printing labels based on the cabinet info and such...but a couple years ago I had to develop a program for the person who does the measuring. He used to carry tons of papers with him to draw on as well as copies of the info (colours/style/house layout) for each job he was going to do each day. Which means each day we had to have someone print out all that for him. But with the help of an add-on called Infragistics (different GUI things that work a bit better than default VB stuff), we developed a program that he can call up info from our database, draw the kitchen with measurements, then submit it while on the road. Results in less paper for him and he can do a lot more on the road. Was kinda annoying to do what was basically a customized paint program...but at the same time, interesting to let it email, pull off our database and such.

  23. #23
    Sr Member n00bMeiSter's Avatar
    Join Date
    Aug 2009
    Posts
    7,253
    Thanks
    62
    Thanked 64 Times in 22 Posts
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by Iceman_F1 View Post
    Our main use is tracking info throughout the shop (Kitchen Manufacture)...so printing labels based on the cabinet info and such...but a couple years ago I had to develop a program for the person who does the measuring. He used to carry tons of papers with him to draw on as well as copies of the info (colours/style/house layout) for each job he was going to do each day. Which means each day we had to have someone print out all that for him. But with the help of an add-on called Infragistics (different GUI things that work a bit better than default VB stuff), we developed a program that he can call up info from our database, draw the kitchen with measurements, then submit it while on the road. Results in less paper for him and he can do a lot more on the road. Was kinda annoying to do what was basically a customized paint program...but at the same time, interesting to let it email, pull off our database and such.
    Wow, that would work wonders with what I'm building.
    I'm going to PM you, as to not hijack anymore.

  24. #24
    Sr Member Slade's Avatar
    Join Date
    Mar 2007
    Location
    Brantford
    Age
    40
    Posts
    2,740
    Thanks
    18
    Thanked 163 Times in 98 Posts
    Mentioned
    22 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Perl > all



    I do a lot of data aggravation from routers, cli , rsh and perl are my tools of choice
    2008 GMC Canyon Crew Cab SLE 4x4
    KICKER / ALPINE / MTX / STINGER / TSUNAMI

  25. #25
    Sr Member n00bMeiSter's Avatar
    Join Date
    Aug 2009
    Posts
    7,253
    Thanks
    62
    Thanked 64 Times in 22 Posts
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)

    Default Re: C++ visual studio 2010 : hellpppp

    Quote Originally Posted by Slade View Post
    Perl > all



    I do a lot of data aggravation from routers, cli , rsh and perl are my tools of choice
    You can't build a video game in Perl

Page 1 of 2 12 LastLast

Similar Threads

  1. Mazda 3 Recording Studio??? YUP!
    By All-Star in forum General Lounge
    Replies: 16
    Last Post: 03-29-2010, 07:19 PM
  2. Some new shots at the studio
    By aznkid.com in forum Multimedia
    Replies: 12
    Last Post: 01-28-2010, 08:56 PM
  3. New BJJ studio opening in hamilton.
    By Son of Zartan in forum General Lounge
    Replies: 0
    Last Post: 10-12-2009, 11:55 PM
  4. Rogers Sale at THS Studio
    By Chiburashka in forum Mazda3 General Discussion
    Replies: 3
    Last Post: 02-10-2007, 03:28 PM

Posting Permissions

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