c++学习历程
wenpu_Di
内心的强大才是真正的强大
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
递归实现求Fibonacci数列的第n项
#include<stdlib.h> #include<string> #include<math.h> #include<iostream> using namespace std; int jich (int x); int main() { int n; cout<<"输出数列的第n项:"; cin>>n; cout<<"Fibonacci数列的第n个数为:"<原创 2015-07-25 21:52:31 · 5480 阅读 · 1 评论 -
结构体练习统计学生成绩
#include<stdlib.h> #include<string.h> #include<iostream> using namespace std; typedef struct { int num; char name[10]; int yuwen; int shuxue; int yingyu; double avg; }student; v原创 2015-08-06 23:38:23 · 838 阅读 · 0 评论 -
学习指针型函数和指向函数的指针
#include<stdlib.h> #include<string> #include<math.h> #include<iostream> using namespace std; char *str(char *a , char *b); int main() { char str1[] = "Hello "; char str2[] = "Welcome C++";原创 2015-08-03 23:33:18 · 439 阅读 · 0 评论 -
练习使用条件编译
#include<stdlib.h> #include<string> #include<math.h> #include<iostream> #define PI 3.1415926 using namespace std; int main() { double s = 0, r, c; cout<<"输入半径 r = "; cin>>r;#ifdef PI原创 2015-08-02 20:39:10 · 306 阅读 · 0 评论 -
strcat()函数与strlen()函数与strcpy()的使用
trcat()函数与strlen()函数(7.21)#include<string.h> #include<stdlib.h> #include<iostream> using namespace std; int main() { char str1[100], str2[100]; cin>>str1; cin>>str2; //cout<<str1<<"\n";原创 2015-07-21 22:51:33 · 734 阅读 · 0 评论 -
gets()与puts()和cin>>与cout<<的比较
—–gets()与puts()和cin>>与cout<<的比较(7.21)—–#include<string.h> #include<stdlib.h> #include<iostream> using namespace std; int main() { char a[100], b[100]; cout<<"输入一个字符串(gets方式):"; gets (a);原创 2015-07-21 22:45:00 · 2375 阅读 · 0 评论 -
1000以内水仙花数(嵌套循环)
*1000以内水仙花数(嵌套循环) 7.20*水仙花数:(各位的立方和等于该数值本身) 算法实现: 1.首先定义三个变量把这个数分解成为百位,十位,和个位。 2.每一个数 int n又可以用(百位*100+十位*10+个位)间接求得。 3.再判断是否 int n与各个位的立方之和 int m相等即可。* #include原创 2015-07-20 18:34:13 · 2372 阅读 · 0 评论 -
自己编写实现strcat()和strcmp()函数
#include<stdlib.h> #include<string> #include<math.h> #include<iostream> using namespace std; void cat (char array1[] ,int m , char array2[] ,int n ); //m,n分别为数组的长度! void cmp (char array1[] ,int m , c原创 2015-08-01 12:56:41 · 1888 阅读 · 0 评论 -
编写一个C++风格的程序,计算输出Fibonacci数列的前20项
## 编写一个C++风格的程序,计算输出Fibonacci数列的前20项 ## * 7.17*#include<iostream> using namespace std; int main() { int *p=new int[20]; *p=1; *(p+1)=1; cout<<*p<<"\t"<<*(p+1)<<"\t"; p=p+2;原创 2015-07-18 22:47:28 · 17225 阅读 · 0 评论 -
const 与#define的使用形式比较
const 与#define的使用形式比较(7.19)#include<iostream> using namespace std; const double PI=3.1415926; int main() { double mianji(double r); cout<<mianji(2)<<"\n"; return 0; } double mianji(double r原创 2015-07-19 20:06:34 · 546 阅读 · 0 评论 -
输出(x/1!)+(x*x*x/3!)+(x*x*x*x*x/5!)+````
学习使用递归算法#include<stdlib.h> #include<string> #include<math.h> #include<iostream> using namespace std; double digui (double x,double n); double jich (double x); int main() { double x, n; cout<<"输原创 2015-07-26 16:55:00 · 774 阅读 · 0 评论 -
选择排序
算法: 把未排序的部分的最小值找出插入到已排序的后边,内层遍历完一次就找到一个最小的,外层控制插入到已排序的后面。 #include<stdlib.h> #include<string> #include<math.h> #include<iostream> using namespace std; template<typename T , int size> void sort ( T原创 2015-07-29 13:22:00 · 393 阅读 · 0 评论 -
********冒泡排序算法**********
#include<stdlib.h> #include<string> #include<math.h> #include<iostream> using namespace std; void maopao (int array[] , int n); int main() { int array[10]; int n; cout<<"输入要排序的10个数字:";原创 2015-07-28 11:10:08 · 376 阅读 · 0 评论 -
模拟操作系统进程调度算法
先来先服务算法: 1.链表存储 2.输入要有先后顺序(没有设计排序算法)#include<iostream> #include <conio.h> #include<stdlib.h> #include<time.h> #include <windows.h> using namespace std;#define NULL 0 int N = 0;//全局变量N,节点个数//进程节点 type原创 2015-11-09 21:25:47 · 1456 阅读 · 0 评论
分享