Connecting Tech Pros Worldwide Forums | Help | Site Map

coin counting problem

Newbie
 
Join Date: Dec 2007
Posts: 2
#1: Dec 3 '07
This program is for a machine wich gives out coins up to the value of £4.99 using the minimun number of coins, but i'm i really having trouble gettin this to work. Any help would really be appreciated

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>

using namespace std;

const int MM=8;
const int NS=500;
const int NC=1200;
const int NV=654;
int v_coins[MM]={200, 100, 50, 20, 10, 5, 2, 1};

#include "ma1990_0708_1.h"
void cs07jjb_a1();
int cs07jjb_num_of_coins(int x, int n_coins[]);
void cs07jjb_compute_and_show(int x, int n_coins[]);
void cs07jjb_show(int x, int n[]);
void get_combination(int i, int m[]);
// .. cs07jjb: any header statements of any optional functions

int main()
{
cs07jjb_a1();
test_this(__FILE__, 0);
return 0;
}

void cs07jjb_a1()
{

// .. cs07jjb[b]:test amount 90

// .. cs07jjb[C]:test amount 277

// .. cs07jjb[D]:test amount 293

// .. cs07jjb[E]:test amount 25

// .. cs07jjb[F]:optional test amounts

// .. cs07jjb[G]:gather the number of coins t[] for each amount in [0, 499]

// .. cs07jjb[H]:loop to collect amounts v[] and number of coins a[]

// .. cs07jjb[i]:loops to get count values b[] for each amount, and also d[]

// .. cs07jjb[J]:loop to get partial sums e[] for storage locations

// .. cs07jjb[K]:loop to get order array o[]

// .. cs07jjb[L]:count the number of combinations with a value>=499

// .. cs07jjb[M]:show the missing amounts and count them

// .. cs07jjb[N]:create the arrays u[] and f[] for the best representations

// .. cs07jjb[O]:count and show the number of amounts with a unique representation

// .. cs07jjb[P]:find and show the amounts with f[i]>=3*t[i]

// .. cs07jjb[Q]:create the file coinage_detail_cs07jjb

}

void cs07jjb_compute_and_show(int x, int n_coins[])
{
// .. cs07jjb[R]:body of cs07jjb_compute_and_show() follows
}

int cs07jjb_num_of_coins(int x, int n_coins[])
{
// .. cs07jjb[S]:body of cs07jjb_num_of_coins() follows
return 0;
}

void cs07jjb_show(int x, int n[])
{
// .. cs07jjb[T]:body of cs07jjb_show() follows
}

// .. cs07jjb[u] any optional functions follow

sicarie's Avatar
Moderator
 
Join Date: Nov 2006
Location: USA
Posts: 3,929
#2: Dec 3 '07

re: coin counting problem


And what is your question?

Did you check out our Posting Guidelines ?
Newbie
 
Join Date: Dec 2007
Posts: 2
#3: Dec 3 '07

re: coin counting problem


i got to use the least amount of coins to get certain number, which are 200p 100p 50p 20p 10p 5p 2p & 1p. i have completed certain parts, however i'm not sure if it is right as it does not compile for some reason.
sicarie's Avatar
Moderator
 
Join Date: Nov 2006
Location: USA
Posts: 3,929
#4: Dec 3 '07

re: coin counting problem


What are the error messages you are getting?
Reply