我的第一个问题2010 [英] MY FIRST QUESTION 2010

查看:64
本文介绍了我的第一个问题2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修订版1
创建一个称为Rational的类,用于对分数进行算术运算.使用整数变量表示分子和分母的类的私有数据.提供一个构造函数,该构造函数允许在声明该类的对象时对其进行初始化.如果未提供初始化程序,则构造函数应包含默认值,并且应以简化形式存储分数.例如,分数将在分子中存储为1,在分子中存储为2.提供执行以下每个任务的公共成员函数:a)重载此类的加法,减法,乘法和除法运算符. b)重载此类的关系和相等运算符. c)以a/b形式打印有理数,其中a是分子,b是分母. d)以浮点格式打印有理数

修订版3
我的问题是如何用C ++完善您的技能
并掌握技能

Revision 1
Create a class called Rational for performing arithmetic with fractions. Use integer variables to represent the private data of the class the numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form. For example, the fraction would be stored in the object as 1 in the numerator and 2 in the denominator. Provide public member functions that perform each of the following tasks: a) Overload the addition, subtraction, multiplication and division operators for this class. b) Overload the relational and equality operators for this class. c) Printing Rational numbers in the form a/b, where a is the numerator and b is the denominator. d) Printing Rational numbers in floating-point format

Revision 3
MY QUESTION IS HOW TO IMPROVER YOUR SKILLS IN C++
AND GET ON SKILLS

推荐答案

我们不为人们做家庭作业.这不是因为我们认为自己胜过这种事情,而是因为学习如何成为一名程序员的一部分是学习如何分析问题,然后设计和实施解决方案.如果您来这里要求我们为您做作业,您将一无所知.
We don''t do homework for people. It''s not because we think we''re above that kind of thing, but because part of learning how to be a programmer is learning how to analyze a problem, and then design and implement the solution. You won''t learn ANYTHING if you come here asking us to do your homework for you.


对不起,您没有cookie:您应该自己做作业.

顺便说一句:这看起来像是一个相当简单的任务,只要您遇到困难,就可以开始编码并在此处发布特定问题.
:)
Sorry, no cookie for you: you should do your own homework.

BTW: it looks like a fairly simple task, start coding and post specific questions here whenever you''re stuck.
:)


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

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