C中的分数问题 [英] Fraction problem in C

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

问题描述

大家好。我有点新手,我可以用一些帮助指出我正确的方向。基本上我必须在分数之间执行基本数学运算并以分数形式输出结果。


现在我只是想让加法和乘法函数起作用。这就是我到目前为止...

Hi all. im kinda new to c and I could use some help to point me in the right direction. basically I have to perform basic math between fractions and put out a result in fraction form.

right now i am just trying to get the add and multiply functions to work . this is what i have so far..

展开 | 选择 | Wrap | 行号

推荐答案

你似乎是使用C ++,我至少期待一个Fraction类。

除此之外,还有以下内容:
You seem to be using C++ and I''d at least expected a Fraction class then.
Besides that, the following:
展开 | 选择 | Wrap | 行号



您似乎正在使用C ++,我至少期待一个Fraction类。

除此之外,还有以下内容:
You seem to be using C++ and I''d at least expected a Fraction class then.
Besides that, the following:
展开 | 选择 | Wrap | 行号



hmm ok im按照我不知道的方式写c c ++但
hmm ok im writing in c by the way i don''t know c++ yet



好​​的,公平的,但是你不应该包含iostream头文件,你应该定义一个可以代表分数的小结构。像这样:

Ok, fair enough, but then you shouldn''t include the iostream header file and you
should define a little struct that can represent a fraction. Something like this:

展开 | 选择 | Wrap | 行号


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

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