Home Forums C Programming Banking

Viewing 1 reply thread
  • Author
    Posts
    • #2160
      StarlaRosas
      Participant

      Hey dudes, I need a help on borland c, I need Some idea, the programs is about, if the user put some amunt of money, The program will have to give 3 ways to get back that amount of money, example, if he put 200
      the computer will say

      2 of one hundred dollar
      10 of twenty dollars
      20 of ten dollars
      “this gives 200 hundred dollars”
      can you give any ideas thats I can start with my programs, clues or something else, to begun with my program. this will be on borland turbo c

    • #3486
      GWILouisaxwzkla
      Participant

      Could do this:


      /****************************************************************
      * File Name : c:programstempcg.cpp
      * Date : December,1,2008
      * Comments : new project
      * Compiler/Assembler :
      *
      *
      *
      *
      *
      * Program Shell Generated At: 2:09:49 p.m.
      =-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/


      #include
      //#include
      //#include
      //#include
      //#include
      //#include

      using namespace std;


      //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ FUNCTION PROTOTYPES @@@@@@@@@@@@@@@@@@@@@@@@@@



      //##################################################################################


      //main function ******************************

      int main ( )
      {

      cout << "Enter change amount : ";
      float change;
      cin >> change;

      int hundreds = 0;
      int fifties = 0;
      int tens = 0;
      int tempChange = change;

      while ( tempChange >= 100 )
      {
      hundreds ++;
      tempChange -= 100;
      }

      tempChange = change;
      while ( tempChange >= 50 )
      {
      fifties ++;
      tempChange -= 50;
      }

      tempChange = change;
      while ( tempChange >= 10 )
      {
      tens ++;
      tempChange -= 10;
      }

      cout << "you can change " << change << " with: " << endl;
      cout << hundreds << " hundreds" << endl;
      cout << fifties << " fifties " << endl;
      cout << tens << " tens" << endl;


      return 0 ;
      }

      output:


      Enter change amount : 200
      you can change 200 with:
      2 hundreds
      4 fifties
      20 tens
      Press any key to continue

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