Home Forums C Programming hi….

Viewing 8 reply threads
  • Author
    Posts
    • #2191
      MerissaQxm
      Participant

      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…)

    • #3555
      GWILouisaxwzkla
      Participant

      could you post your source code?

    • #3556
      MerissaQxm
      Participant

      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…..

    • #3557
      GWILouisaxwzkla
      Participant

      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……..

    • #3558
      GWILouisaxwzkla
      Participant

      oops. try this version with total as a double :

    • #3559
      MerissaQxm
      Participant

      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…..?

    • #3560
      GWILouisaxwzkla
      Participant

      yeah , that makes sence :) .

    • #3561
      MerissaQxm
      Participant

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

    • #3562
      GWILouisaxwzkla
      Participant

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

Viewing 8 reply threads
  • The forum ‘C Programming’ is closed to new topics and replies.