• MerissaQxm
    Member
    Post count: 5
    #2191 |

    i’m new c++….and i have jus started learnin …i’m a beginnner….
    so cud sum1 pls correct dis code….and suggest sum changes….so dat it calculates da bill even if da items r bought at random…?(…..coz now it only calculates da bill if da items r bought in an order…)

  • GWILouisaxwzkla
    Member
    Post count: 94
    #3555 |

    could you post your source code?

  • MerissaQxm
    Member
    Post count: 5
    #3556 |

    i know dis is da wrong way 2 b doin da program….but i’m jus a beginner….so dis is da best i cud think of….and i seriously need all da help dat i can get….plsssssssssssssss…..

  • GWILouisaxwzkla
    Member
    Post count: 94
    #3557 |

    heres a start ( I’m not certain why you are dividing every purchase in the program by 1000 ) . By the way don’t use “gotos” in high level programming languages , this is considered bad programming practice ( google Dijkstra ). Anyway , this is how I might code what you have ( the total comes out 0 since everything is divided by 1000 ). Anyway……..

  • GWILouisaxwzkla
    Member
    Post count: 94
    #3558 |

    oops. try this version with total as a double :

  • MerissaQxm
    Member
    Post count: 5
    #3559 |

    i divide dem all wid 1000…coz….its like….I USED DA FOLLOWIN LOGIC…
    for 1000g –> it costs Rs.100.00
    so for xg –>it should cost Rs. (100*x)/1000
    SO…must i not divide it by 1000…..?

  • GWILouisaxwzkla
    Member
    Post count: 94
    #3560 |

    yeah , that makes sence :) .

  • MerissaQxm
    Member
    Post count: 5
    #3561 |

    :)
    so….da program WILL give me da expected result…..rite…?

  • GWILouisaxwzkla
    Member
    Post count: 94
    #3562 |

    If your original calculations are correct it should be fine. You’ll need to test the program thought…….

You must be logged in to reply to this topic.