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(in t x, int n[]);
void get_combination (int i, int m[]);
// .. cs07jjb: any header statements of any optional functions
int main()
{
cs07jjb_a1();
test_this(__FIL E__, 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(in t x, int n[])
{
// .. cs07jjb[T]:body of cs07jjb_show() follows
}
// .. cs07jjb[u] any optional functions follow
3 2954
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 4,677
Recognized Expert Moderator Specialist
What are the error messages you are getting?
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 quarter into a coin slot and get 15 minutes of time on
an account that has "restricted" Internet access via the firefox web browser. We are
experimenting with different ways to allow kids to safely surf the web during school hours
while...
|
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
|
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 number of coins
number of quarters
number of dimes
|
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 -1
|
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. How do I get a computer to flip coin and get result? Any ideas???
Any help will be greatly appreciated greatly!!!!!!!!
Andy
| |
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 this but the part that i am stuck on is how to print a summary at the end of this program tracking how many wins and how many losses.
import cs1.Keyboard;
public class CoinToss6
{
public static void main(String args)
{
...
|
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 ()
{
int coin, counter, tails = 0, heads = 0;
for (counter = 1; counter <= 100; counter++)
|
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 should be return to the main program. I'm having trouble figuring it out, can anyone please help?
#include <iostream>
using namespace std;
# include <ctime>
int coin();
|
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, well-grounded the top formerly larboard piece is kinda scratched.
How much do you meditate on it's worth? pic of coin is here: http://coindad.com/coin/Cent_1803_F.jpg"
http://coindad.com/coin/Cent_1803_F.jpg
|
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 coin and my character and when this = true set the coin to _visible = false, move it way off screen and add 10 point to the _global.score. all is working fine but I haven't a clue about having more than one instance of the coin, or more precisely I...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |