绝对C ++计数器问题 [英] Absolute C++ counter problem

查看:77
本文介绍了绝对C ++计数器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个编程项目我不知道如何实现。以下是它的要求:


我母亲总是带着一个小红色柜台到杂货店。如果她买了篮子里的所有东西,那么这个柜台用来记录她到访商店时所花费的金额。计数器有一个四位数显示,每个数字的增量按钮和一个复位按钮。如果输入的金额超过其注册的99.99美元,则溢出指示符会变为红色。


如何将此想法实现到C ++代码中?只是一些提示,我无法想出这一点,任何提示都会非常感激。如果有人有这本书可以帮助我,我会非常感激


提前谢谢。

There is a programming project that I just don''t know how to implement. Here is what it is asking:

My mother always took a little red counter to the grocery store. The counter was used to keep tally of the amount of money she would have spent so far on that visit to the store if she bought everything in the basket. The counter had a four digit display, increment buttons for each digit, and a reset button. An overflow indicator came up red if more money was entered than the $99.99 it would register.

How would I implement this idea into C++ code? just some hints, I can''t figure this one out, any hint would be greatly appreciated. If anyone has the book and can help me, I would be very thankful

Thanks in advance.

推荐答案

99.99它会注册。


如何将这个想法实现到C ++代码中?只是一些提示,我无法想出这一点,任何提示都会非常感激。如果有人有这本书并且可以帮助我,我将非常感谢


提前致谢。
99.99 it would register.

How would I implement this idea into C++ code? just some hints, I can''t figure this one out, any hint would be greatly appreciated. If anyone has the book and can help me, I would be very thankful

Thanks in advance.



有一个编程项目我不知道如何实现。以下是它的要求:


我母亲总是带着一个小红色柜台到杂货店。如果她买了篮子里的所有东西,那么这个柜台用来记录她到访商店时所花费的金额。计数器有一个四位数显示,每个数字的增量按钮和一个复位按钮。如果输入的金额超过
There is a programming project that I just don''t know how to implement. Here is what it is asking:

My mother always took a little red counter to the grocery store. The counter was used to keep tally of the amount of money she would have spent so far on that visit to the store if she bought everything in the basket. The counter had a four digit display, increment buttons for each digit, and a reset button. An overflow indicator came up red if more money was entered than the


99.99它会注册,溢出指示符会变为红色。


我如何将这个想法实现到C ++代码中?只是一些提示,我无法想出这一点,任何提示都会非常感激。如果有人有这本书并且可以帮助我,我会非常感激


提前谢谢。
99.99 it would register.

How would I implement this idea into C++ code? just some hints, I can''t figure this one out, any hint would be greatly appreciated. If anyone has the book and can help me, I would be very thankful

Thanks in advance.



所以看起来你需要一个总数,一个指标,如果你有没有溢出,并测试你是否有溢出。


如果你将这些东西放在一个退出哨兵的循环中(可能是溢出,可能是一个角色),你就会拥有它。


是有什么特定的你遇到麻烦吗?

So it seems you need a number for the total, an indicator if you have overflowed or not, and a test to see if you have overflowed.

If you put those things into a loop that exited on a sentinel (possibly overflow, possibly a character), you''d have it.

Is there something specific you are having trouble with?


这篇关于绝对C ++计数器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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