亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fraction.cpp

?? A Fraction class that has the ability to add, subtract, multiply, divide and show various statistics
?? CPP
字號:
//--------------------------------------------------------------
//
// F R A C T I O N  C L A S S
//
// F R A C T I O N . C P P
//
// Version 1.1, Copyright (C) 2001, by Daniel Pronych
//
// FREEDOM to USE and DISTRIBUTE is LIMITED ONLY TO THE
// EDITTING OF THIS TITLE ON THIS, and ALL ACCOMPANYING FILES.
// THIS FILE IS PLACED INTO PUBLIC DOMAIN in hopes that it
// might be found useful for others.  It is not FORCEFULLY 
// placed into public domain but with consent from the AUTHOR.
//
// C L A S S  D E S C R I P T I O N
// --------------------------------
//
// This file, provides a body to the functions declared in 
// Fraction.h and must not be seperated from it, lest it stop 
// functioning and benefit no one.
//
// This Fraction class allows extreme flexibility in working
// with fractions.  When a fraction is declared and the user
// and or client program implements a fraction with a negative
// denominator this class quickly distributes it to both the
// numinator and denominator to keep with what one would 
// normally do with Fractions in a Math class.  Operators are
// defined to work with extreme ease for the user of this class.
// A Reduce fraction is included to allow the user to use to
// simply the fraction that they are dealing with.
//
// Pre/Post conditions have been added to simplify the Class.
//
// Have fun with this class!
//--------------------------------------------------------------
Fraction::Fraction()
	:num(0), den(1) // Sets default values for Fraction Class
{
	// Constructor has no need to initialize any other code
	// in it's current state
}
//-----------------------------------------------------
Fraction::~Fraction()
{
	// Deconstructor contains no code at the moment
}
//-----------------------------------------------------
void Fraction::SetNum(BIGGEST_INT newnum)
//pre : Call to set the numerator
//post: new numerator is set
{
	num = newnum;
}

//-----------------------------------------------------
void Fraction::SetDen(BIGGEST_INT newden)
// pre : Call to set the deminator
// post: Validate if negative and set new denominator
{
	den = newden;
	if(den < 0) {
		num *= -1;
		den *= -1;
	}
}
//-----------------------------------------------------
void Fraction::SetAll(int Fracnum)
// pre : Fraction is defined, and program seeks input from user
// post: User has given two values and if denominator is 
//		 negative it is now made positive
{
	BIGGEST_INT newnum = 0, newden = 0;
	cout << "\nEnter a value for the numerator in Fraction " << Fracnum << ". ";
	cin >> num;
	cout << "\nEnter a value for the denominator in Fraction " << Fracnum << ". ";
	cin >> den;

	if(den < 0) { // Choke out negative denominators as soon as they are inputted.
		num *= -1;
		den *= -1;
	}
}
//-----------------------------------------------------
BIGGEST_INT Fraction::Num()
// pre: any call made to use numerator in Fraction class
{
	return(num);
}
//-----------------------------------------------------
BIGGEST_INT Fraction::Den()
// pre: any call made to use denominator in Fraction class
{
	return(den);
}
//-----------------------------------------------------
void Fraction::Reduce()
// pre : Function is called with a Fraction to reduce
// post: Function is reduced as far as possible
{
	BIGGEST_INT rdc = 0; // Reduce value
	if(den > num) // Makes sure the greater number is sent to the Function first
		rdc = GCD(den, num);
	else if(den < num)
		rdc = GCD(num, den);
	else
		rdc = GCD(num, den);
	num /= rdc; // Simplifies Fraction's Numerator
	den /= rdc; // Simplifies Fraction's Denominator
}
//-----------------------------------------------------
void Fraction::DisplayMixed()
{
	cout << "Mixed value: " << num / den << " " << num % den << "/";
	if(den < 0) /* Don't let the denominator of the mixed number appear negative
					if the value is negative it's displayed in the whole number. */
		cout << den * -1;
	else
		cout << den;
	cout << endl;
}
//-----------------------------------------------------
float FracDecVal(Fraction a)
// pre: Function is given one fraction to find the decimal value of
// post: Function returns the decimal value of given fraction
{
	float fracnum = a.num; // Make numerator a floater to prevent loss of data
	float fracden = a.den; // Make denominator a floater to prevent loss of data
	float decval = fracnum / fracden; // Decimal value variable
	return(decval);
}
//-----------------------------------------------------
BIGGEST_INT Fraction::GCD(int num1, int remainder)
// pre : Function is given two values (numerator and denominator)
// post: Function returns the greatest common factor to client
{
	if(remainder == 0)
		return(num1);
	else {
		return(GCD(remainder,num1%remainder));
	}
}
//-----------------------------------------------------
Fraction Fraction::operator +(Fraction d)
// pre : Function is given two valid Fractions to add
// post: Function returns the added value of the Fractions as is
{
	Fraction retfrac;
	retfrac.num = (num * d.den) + (d.num * den);
	retfrac.den = d.den * den;
	return(retfrac);
}
//-----------------------------------------------------
Fraction Fraction::operator -(Fraction d)
// pre : Function is given two valid Fractions to subtract
// post: Function returns the subtracted value of the Fraction as is
{
	Fraction retfrac;
	retfrac.num = (num * d.den) - (d.num * d.den);
	retfrac.den = d.den * den;
	return(retfrac);
}
//-----------------------------------------------------
Fraction Fraction::operator *(Fraction d)
// pre : Function is given two valid Fractions to multiply
// post: Function returns the multiplied value of the Fraction as is
{
	Fraction retfrac;
	retfrac.num = num * d.num;
	retfrac.den = den * d.den;
	return(retfrac);
}
//-----------------------------------------------------
Fraction Fraction::operator /(Fraction d)
// pre : Function is given two valid Fractions to divide
// post: Function returns the divided value of the Fraction as is
{
	Fraction retfrac;
	retfrac.num = num * d.den;
	retfrac.den = den * d.num;
	if(retfrac.den < 0) { // Just in case the inversion caused the denominator to be negative
		retfrac.num *= -1;
		retfrac.den *= -1;
	}
	return(retfrac);
}
//-----------------------------------------------------
Fraction Fraction_Do_Op(int operation, Fraction a, Fraction b) 
// pre : Function is given operation and two Fractions
// post: Function completes the operation and returns to client
{
	Fraction rc;
	switch (operation) {
	case FRAC_ADD:
		return (a + b);
	case FRAC_SUB:
		return (a - b);
	case FRAC_MUL:
		return (a * b);
	case FRAC_DIV:
		return (a / b);
	}
	rc.SetNum(1);
	rc.SetDen(1);
	return (rc);
}
//-----------------------------------------------------

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区爽爽爽爽爽 | 99久久婷婷国产精品综合| 国产成人亚洲综合a∨婷婷图片| 欧美日韩精品二区第二页| 亚洲国产视频一区| 91精品国产品国语在线不卡| 日韩av一区二区三区四区| 日韩亚洲电影在线| 国产成人精品免费在线| 极品少妇一区二区| 亚洲免费资源在线播放| 欧美日韩国产综合草草| 欧美亚男人的天堂| 国产成人免费视频一区| 成人sese在线| 男男视频亚洲欧美| 亚洲激情av在线| 91小视频在线观看| 欧美国产欧美亚州国产日韩mv天天看完整| 久久国产精品99久久久久久老狼| 久久久噜噜噜久久人人看| 日韩影院在线观看| 国产精品亲子乱子伦xxxx裸| 欧美视频在线观看一区二区| 在线精品视频免费播放| 丰满亚洲少妇av| 激情六月婷婷久久| 一区二区三区精品视频| 日本一区二区视频在线观看| 6080国产精品一区二区| 在线精品视频免费观看| 777奇米四色成人影色区| 精品99999| 欧美美女直播网站| 亚洲国产精品一区二区www在线 | 色综合色综合色综合色综合色综合 | 国产清纯美女被跳蛋高潮一区二区久久w| 欧美不卡123| 欧美日韩国产高清一区二区三区 | 亚洲一级二级三级| 一区二区三区蜜桃| 亚洲天堂中文字幕| 中文字幕不卡在线观看| 亚洲精品中文在线观看| av亚洲精华国产精华精华| 美女www一区二区| 日韩av中文字幕一区二区| 国产成人午夜99999| 欧美三级日韩三级| 欧美日韩国产另类一区| 中文字幕精品在线不卡| 日本午夜精品一区二区三区电影| 国产**成人网毛片九色| 678五月天丁香亚洲综合网| 中文字幕亚洲一区二区va在线| 国产精品电影一区二区| 成人欧美一区二区三区白人| 毛片av一区二区| 在线观看成人小视频| 中文字幕欧美三区| 精久久久久久久久久久| 欧美男女性生活在线直播观看| 中文字幕日韩一区| 黄色小说综合网站| 日韩一级精品视频在线观看| 亚洲一区二区三区国产| av在线播放不卡| 欧美国产激情一区二区三区蜜月| 麻豆成人免费电影| 在线91免费看| 日日夜夜精品视频天天综合网| 欧美综合一区二区| 亚洲综合免费观看高清完整版在线 | 久久一夜天堂av一区二区三区| 欧美日韩国产在线观看| 欧美成人伊人久久综合网| 午夜精品视频在线观看| 精品一区二区精品| 日韩一区二区三区在线视频| 午夜欧美大尺度福利影院在线看| 在线免费观看日本欧美| 亚洲综合色视频| 欧美日韩国产色站一区二区三区| 亚洲国产三级在线| 欧美精品九九99久久| 日韩国产一二三区| 精品国产一区二区在线观看| 国产乱码精品1区2区3区| 91传媒视频在线播放| 久久―日本道色综合久久| 国产高清在线观看免费不卡| 中文字幕免费不卡在线| 色综合久久久久综合体桃花网| 亚洲品质自拍视频| 欧美日韩免费电影| 精品一区二区在线看| 国产无人区一区二区三区| 精品免费日韩av| 日韩成人av影视| 欧美一区二区精品久久911| 琪琪久久久久日韩精品| 久久亚区不卡日本| 99久久精品免费看| 午夜天堂影视香蕉久久| 欧美精品一区二区三区蜜桃视频| 国内不卡的二区三区中文字幕| 国产清纯白嫩初高生在线观看91| 99re热这里只有精品免费视频| 亚洲福利一区二区三区| 欧美精品一区二区三区高清aⅴ | 亚洲黄色免费网站| 91精品国产综合久久精品| 国产一区二区三区免费观看| 国产激情视频一区二区在线观看 | 67194成人在线观看| 天天综合色天天综合色h| 日韩精品一区二区三区中文精品 | 在线成人小视频| 国产电影一区在线| 亚洲第一av色| 欧美日韩在线一区二区| 国产麻豆一精品一av一免费| 亚洲男同性视频| 欧美精品一区二区三区一线天视频| 色综合色综合色综合色综合色综合| 蜜桃av一区二区三区电影| 中文字幕一区二区三区色视频| 欧美日韩久久久久久| 99久久精品99国产精品| 国产一区二区导航在线播放| 夜夜精品浪潮av一区二区三区| 久久精品亚洲乱码伦伦中文 | 久久99精品国产| 一区二区高清视频在线观看| 久久久www成人免费无遮挡大片| 欧美日韩成人激情| 色综合天天做天天爱| 一区二区在线观看免费| 国产欧美日韩精品一区| 欧美丰满少妇xxxbbb| 91国偷自产一区二区三区观看| 国产91精品精华液一区二区三区 | 国产精品白丝在线| 久久一区二区三区四区| 亚洲欧洲国产专区| 久久综合成人精品亚洲另类欧美 | 欧美久久久久久久久中文字幕| 99re热这里只有精品免费视频| 国产成人免费视频网站| 国内精品久久久久影院薰衣草| 青青青伊人色综合久久| 天堂在线亚洲视频| 亚洲va欧美va天堂v国产综合| 亚洲欧美日韩电影| 亚洲最新视频在线播放| 中文字幕一区视频| 亚洲精品日产精品乱码不卡| 亚洲天堂成人网| 亚洲欧美区自拍先锋| 一区二区三区国产豹纹内裤在线 | 在线成人午夜影院| 欧美一区日本一区韩国一区| 欧美一级免费大片| 日韩精品专区在线影院观看| 精品国产在天天线2019| 久久久久久97三级| 麻豆视频一区二区| 欧美亚洲国产怡红院影院| 成人激情动漫在线观看| 国产91精品一区二区| 91一区一区三区| 欧美亚洲免费在线一区| 91麻豆精品国产91久久久使用方法 | 午夜一区二区三区在线观看| 日一区二区三区| 国产一区在线视频| 91在线视频官网| 日韩精品一区二| 欧美激情一区二区三区不卡 | 国产老女人精品毛片久久| 成人精品小蝌蚪| 亚洲成av人综合在线观看| 丝袜国产日韩另类美女| 国产在线视频一区二区三区| 成人美女在线观看| 欧美色成人综合| 久久精品欧美日韩精品| 亚洲三级免费观看| 老鸭窝一区二区久久精品| 国产成人午夜片在线观看高清观看| 色综合久久久久综合体| 亚洲精品一区二区三区精华液| 1024成人网| 美女视频黄免费的久久| 日本韩国欧美国产| 久久―日本道色综合久久| 亚洲一区视频在线| 成人av综合一区| 日韩欧美黄色影院| 夜夜夜精品看看|