处理类和函数的C ++赋值 [英] C++ assignment dealing with classes and functions

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

问题描述

我不确定这个学校项目是否正朝着正确的方向前进。我想创建一个3档,基于类的程序,它将允许您运行一个非常简单的比萨店程序。菜单应该与下面显示的类似。


菜单

----------------- -------------------------------------------------- -------------------------

A)你想要多大比例的披萨?

B)您想要什么类型的浇头?

C)显示/下订单当前订单。

D)取消当前订单。

E退出程序。


我只试图完成前2个菜单项。任何人都可以告诉我,我是否朝着正确的方向前进。我需要3天才能完成这项任务,所以任何建议都会非常感激。这是我到目前为止的代码:

I''m not sure if I''m heading in the right direction with this school project. I am suppose to create a 3 file, class based program that will allow you to run a very simple pizza parlor program. The menu should be displayed similar to what is shown below.

MENU
--------------------------------------------------------------------------------------------
A) What size of pizza do you want?
B) What type of toppings do you want?
C) Display/Place current order.
D) Cancel current order.
E) Quit program.

I''ve only attempted to complete the first 2 menu items. Can anyone tell me if I''m heading in the right direction. I have 3 days before I need to finish this so any suggestions would be greatly appreciated. Here''s the code I have so far:

展开 | 选择 | Wrap | 行号

推荐答案

一切看起来目前很好。我注意到的一件事是,当你从main(在switch语句中)调用size()函数时,你不传递任何参数。但是,在定义的开头,你有一个参数 - 一个参考披萨对象。这在您的文档中也有提及。也许你应该做一个比萨饼,然后使用那个披萨调用大小。您也可以打电话给浇头等,直到客户完成比萨饼,然后将其添加到他们的订单。
Everything looks good so far. One thing I noticed is, when you call the size() function from your main (inside the switch statement), you pass it no arguments. But, in the start of your definition, you have a single argument - a reference pizza object. This is also mentioned in your documentation. Perhaps you should make a pizza, and then call size using that pizza. You can also call toppings, etc. until the customer is done with the pizza, then add it to their order.


我理解你所说的关于不通过我的尺寸功能... ..我可以传递默认值10......但是,不确定你的意思是先制作比萨饼,然后再调用大小和浇头。你的意思是我应该首先在所有默认参数(首选大小和顶级菜单)中制作披萨吗?谢谢你早些时候的回复。将在明天继续研究项目。
I understand what you said about passing nothing to my size function.....I can just pass a default value of 10"......however, not sure what you mean about making a pizza first and then calling size and toppings. Do you mean I should first make a pizza feeding in all the default arguments (first choices of size and topping menu)? Thank you for your earlier reply. Will continue working on project tomorrow.


展开 | 选择 | Wrap | 行号


这篇关于处理类和函数的C ++赋值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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