- 博客(10)
- 收藏
- 关注
原创 补1
一、问题及代码#includeiostream> #includeiomanip> #includecstdlib> using namespace std; class Date; //对Date类的提前引用声明 class Time { public: Time(int,in
2017-05-08 23:02:55 201
原创 补2 项目五--5
一、问题及代码#include #include using namespace std; int gcd(int m, int n); class CFraction { private: int nume; // 分子 int deno; // 分母 public: CFraction(
2017-05-07 21:29:30 198
原创 C++N4 作业(项目二、三、四)
项目二:奇偶阶乘 定义一个有10个的数组a,输出数组a中所有的奇数的阶乘和和偶数的阶乘和。其中将奇偶数的判断和阶段的计算定义为函数。一、代码二、运行结果项目三:杨辉三角 编写函数,形成n阶杨辉三角形。在主函数中调用该函数,形成杨辉三角形,并输出结果。输入阶数n,输出处理后的结果。 一、代码二、运行结果项目四: 从有一个10个数的数组,求出这
2017-04-10 15:36:08 298
原创 C++N4 实验 (项目一)
一、问题及代码 定义一个有10个的数组a,将数组a中的所有素数放在数组b,再对数组b排序。#include using namespace std;int prime(int x);void sort(int p[], int n); //数组排序 prime(int x); //素数判断void print(int p[],int n);//输出数组int ma
2017-04-10 15:30:19 311
原创 C++实验:选择(项目2)+循环(项目7)
一、问题及代码《一》项目2:本月有几天?#include using namespace std; int main() { int year,month; cout cin>>year>>month; switch(month) { case 1: case 3:
2017-03-13 21:25:01 177
原创 实验C++N2:选择(项目4)+循环(项目5)
一、问题及代码《项目4 :多分数段函数求值》#include#includeusing namespace std;void main(){ double x,y; cout cin>>x; if(x y=x; if(x>=2&&x y=x*x+1; if(x>=6&&x y=sqrt(x+1); if(x>10) y=1
2017-03-13 15:40:17 178
原创 C++第一次上机项目3
一、问题及代码 #include#includeusing namespace std;int main(){float x1,x2,y1,y2,distance,r;cout cin>>x1>>y1;coutcin>>x2>>y2;r=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); distance=sqrt(
2017-02-27 15:33:13 215
原创 C++第一次上机报告项目2
一、问题及代码#includeusing namespace std;int main(){int x,y;coutcin>>x;if(x>=1)y=x-1;elsey=-x-1;coutreturn 0;}二、运行结果三、心得体会第一次接触C++,由于之前学过C,感觉C++蛮简单!
2017-02-27 15:05:05 186
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人