关于ATM机程序的问题 [英] Question about ATM Machine Program

查看:71
本文介绍了关于ATM机程序的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这个项目让我感到非常难过。我已经相当远了,我以为我已经完成了,只是为了看到我的答案完全没了。因为我是新手,我甚至不知道将它发布到哪个论坛。我用基本的C语言编写了我的程序。这个
是我的任务......"你的项目将像ATM一样,从最高面额开始分配正确的电量并开始工作。对于这个项目,我们将使用20美元,10美元,5美元,1美元,四分之一,硬币,镍币和便士。
计划将要求用户提供金额(> = 0 AND< = $ 100),您的工作是打印出更改,以便按照下面显示的格式请求原始金额。" 

So the project is I am super stumped on. I got pretty far into it and i thought I was done, Only to see that my answers are completely off. Because Im new to this i did not even know what forum to post it to. I wrote my program in basic C language. This was my assignment... "Your project will act like an ATM dispensing the correct amount of charge starting with the highest denomination and working down. For the project we'll be using $20's, $10's, $5's, $1's, quarters, dimes, nickels, and pennies. The program will ask for amount from the user (>=0 AND <= $100) and you job is to print out change to dispense following by the original amount requested in the format shown below." 

到目前为止,我有这个......

So far I have this...


#include < stdio.h >

推荐答案

在1/24/2019 8:47 PM,Dino000121写道:

On 1/24/2019 8:47 PM, Dino000121 wrote:


到目前为止,我有这个...
$


#include< stdio.h>

#define startingSize 100

int main(无效){
$
浮动金额;



printf("请输入要分配的金额

So far I have this...

#include <stdio.h>
#define startingSize 100
int main(void){
float amount;

printf("Please enter amount to dispense in



form(dollars.cents):");



scanf("%f"& amount);

printf ("ATM处理... \ nATM预先取款...... \ n");

int dollar =金额;

剩余浮动=(金额 - 美元) )* 100;



//现金

二十几岁=剩余/ 20;
form (dollars.cents): ");

scanf("%f",&amount);
printf("ATM processing...\nATM preforming withdrawal...\n");
int dollars=amount;
float remaining=(amount- dollars)*100;

//Cash
int twenties=remaining/20;

"剩余"是美分。你不要使用"美元"。完全在你的计算中。

"remaining" is cents. You don't use "dollars" at all in your calculations.


/硬币

int quarters =剩余
.25;

"剩余的"是美分(你乘以100),但是你用美元除以金额。

"remaining" is in cents (you multiplied by 100), but you are dividing by an amount in dollars.


这篇关于关于ATM机程序的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆