題目: 分數計算器設定
班級: k0312415
專業: 電腦科學與技術
學號: k031241521
k031241535
姓名: 周林
指導教師
小組成員: 周林,張齊滿
二o一三年 10 月 15 日
一、課程設計問題描述
分數計算器設計是高等學校教務管理的重要組成部分,其內容較多,為了簡化計論,要求設計的管理系統能夠完成以下功能:
(1)定義整數類和分數類。其中,包括建構函式、析構函式、顯示函式等。
(2)輸入/輸出:對流提取和流插入運算子進行過載。
(3)計算功能:可進行分數的加、減、乘和除法運算。
(4)化簡功能:將分數化簡為最簡分數。
(5)異常處理功能:分數中分母不能為零。
(6)選單功能:每種功能的操作都是在選單中進行相應選擇。
二、課程設計目的和要求:
經過乙個學期的《c++物件導向程式設計》課程的學習,已經有了一定地程式設計基礎,但是要學好c++物件導向程式設計這門課程,不僅要認真閱讀課本知識和從事課堂學習,更重要的是要進行上機實踐,通過上機實踐才能增強和鞏固知識。
三、系統設計(演算法分析)
1、 系統由5功能,可分別執分數的.加法運算, 減法運算 ,.乘法運算和除法運算,還可以將分數化簡。
1.加法運算可計算兩個分數相加。
2.減法運算可計算兩個分數相減。
3.乘法運算可計算兩個分數相乘。
4.除法運算可計算兩個分數相除。
5.化簡運算可計算乙個分數化簡。
2、流程圖
3、分數計算器設定各函式的功能和實現的相關功能由對應的函式來實現。
(1) 函式jia()實現分數加法運算。
(2)函式jian()實現分數減法運算。
(3)函式cheng()實現分數乘法運算。
(4)函式chu()實現分數除法運算。
(5)函式shuchu()實現分數的輸出和化簡。
四、程式源**
// 分數管理系統.cpp : defines the entry point for the console application.
//#include "stdafx.h"
#include "fenshu.h "
#include "zhengshu.h"
int main(int argc, char* argv)
// zhengshu.h: inte***ce for the zhengshu class.
//#if !defined(afx_zhengshu_h__254bb13e_9f27_4785_bdee_637c9445f651__included_)
#define afx_zhengshu_h__254bb13e_9f27_4785_bdee_637c9445f651__included_
#if _msc_ver > 1000
#pragma once
#endif // _msc_ver > 1000
class zhengshu
;#endif // !defined(afx_zhengshu_h__254bb13e_9f27_4785_bdee_637c9445f651__included_)
// zhengshu.cpp: implementation of the zhengshu class.
//#include "stdafx.h"
#include "zhengshu.h"
// construction/destruction
zhengshu::zhengshu()
zhengshu::~zhengshu()
// fenshu.h: inte***ce for the fenshu class.
//#if !defined(afx_fenshu_h__6e3e6a1a_943d_4cb4_87d1_758261f44f66__included_)
#define afx_fenshu_h__6e3e6a1a_943d_4cb4_87d1_758261f44f66__included_
#if _msc_ver > 1000
#pragma once
#endif // _msc_ver > 1000
#include "zhengshu.h"
class fenshu : public zhengshu
;#endif // !defined(afx_fenshu_h__6e3e6a1a_943d_4cb4_87d1_758261f44f66__included_)
// fenshu.cpp: implementation of the fenshu class.
//#include "stdafx.h"
#include "fenshu.h"
#include "iostream"
using namespace std;
// construction/destruction
fenshu::fenshu()
fenshu::~fenshu()
int fenshu::disply()
else }
}return 0;}
fenshu::jia()
fenshu::jian()
fenshu::cheng()
fenshu::chu()
fenshu::shuchu(int q,int w)
}cout<<"結果為"< 遼寧工程技術大學上機實驗報告 class program class object public void isspecialchar stringbuilder sb 檢測給定的字串是否含有字母,數字和下劃線 string str int a 0,b 0,c 0 for int i 0 i i i... 物件導向程式設計 c 語言程式設計 課程設計一 設計目的 1.基本掌握物件導向設計的基本思想和方法2.熟練掌握c 語言的基本知識和技能 3.能夠利用所學的基本知識和技能,開發小型應用程式二 設計要求 1.要求利用c 語言物件導向的程式設計思想即組建來完成系統設計2.功能設計必須考慮實用性 3.介面美... 目錄前言 3 第一章概述 4 1 1 課程設計目的 4 1 2 基本要求 4 1 3 考核方法和成績評定 5 1.3.1 考核方法 5 1.3.2 成績評定 5 第二章程式設計方法與常用演算法 6 2 1 程式設計與演算法 6 2.1.1 演算法 6 2.1.2 結構程式設計 7 2.1.3 物件導...
物件導向與程式設計C課程設計
物件導向程式設計C 課程設計題目要求
物件導向程式設計C 課程設計指導書