473,388 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

coin counting problem

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
Dec 3 '07 #1
3 2939
sicarie
4,677 Expert Mod 4TB
And what is your question?

Did you check out our Posting Guidelines ?
Dec 3 '07 #2
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.
Dec 3 '07 #3
sicarie
4,677 Expert Mod 4TB
What are the error messages you are getting?
Dec 3 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jon Monteleone | last post by:
Greetings, I posted a few days back and didnt get much of a response, so I figured I would post again with more detail. I am running gnome under fedora core 4. I want a kid to be able to drop a...
12
by: DannyB | last post by:
I'm just learning Python. I've created a simple coin flipper program - here is the code: #Coin flipper import random heads = 0 tails = 0 counter = 0
3
by: viewsonic | last post by:
Help, im a student that has to write a program for counting coins. Half of the program works but the other half doesn.t should have the following parameters. output is: Name Date total...
52
by: celerysoup16 | last post by:
I've written this coin toss program, and can't figure out why it isn't giving accurate results... cheers, Ben #include <stdlib.h> #include <stdio.h> #define H 1 #define T 0 #define SENTINEL...
0
by: coolindienc | last post by:
Honestly, I am totally lost about this program. I don't even know where to start. At first I thought I can ask a user to flip a coin. But then again one will get bored flipping coin fot 100 times....
5
by: sallyk57 | last post by:
I have to make a program that would ask a user for their guess (heads or tails) and tells them if its correct or not then it has to ask the user if they want to play again. I figured out how to do...
6
blackstormdragon
by: blackstormdragon | last post by:
I just started a C++ class and now we're doing loops and have to make a coin flipping program. Well here's mine: #include<iostream> #include<cstdlib> using namespace std; int flip(); void main...
8
by: PAK11 | last post by:
This is what i have so far.......I need to add a function named coin to simulate a coin toss where heads is represented by a 1 and tails a 2. The outcome of the toss should be printed and the result...
0
Chuncatty
by: Chuncatty | last post by:
How much does a Draped Bust coin fabricate cost? (Sorry for my Eng) I ask a beau to see if it's genuine he said it is, down repay a collage professor i met said so. It's in virtue word,...
18
by: Chinde | last post by:
Hi I'm using AS2 to produce a simple platform game. So far so good I would like the character to collect coins or whatever. so what I have done is create a coin movie clip, I've run a hittest on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.