
基础篇
基础
竹骄傲
遇事不决,可问春风
展开
-
绝对素数(c语言)
问题:编写一个程序,输入两个正整数,输出两个正整数之间的绝对素数;运行图:源代码:#include <stdio.h> int main(){ int a,b; int i,x,y,z; int h=0,v; scanf("%d %d",&a,&b); for(i=a;i<=b;i++) { int j; for(j=2;j<i;j++) { if(i%j==原创 2022-02-12 16:19:36 · 2494 阅读 · 4 评论 -
加1秒后的时间(c++)
问题:编写一个程序,输入时间,输出加1秒后的时间;运行图:源代码:#include <iostream> using namespace std; int main() { int a,b,c,d=1; cout<<原创 2022-02-09 15:22:18 · 1166 阅读 · 0 评论 -
判断相亲数(c语言)
问题:编写一个程序,输入两个正整数,判断它们是否是相亲数;运行图:源代码:#include <stdio.h>int sum(int x){ printf("%d,",x); int i,j,k,z=0,p=0,h=0; int l[20]; for(k=x-1;k>1;k--) { if(x%k==0) { z=k; break; } } for(i=1,j=0;i&l原创 2022-02-08 14:54:36 · 2329 阅读 · 2 评论 -
定义并实现一个银行类
问题:编写一个程序,定义并实现一个银行类;运行图:源代码:#include <iostream>#include <iomanip>#include <string.h>using namespace std;class bank{ private: long id; double balance; static double Rational; double ck; public: ba.原创 2022-02-02 22:56:34 · 1049 阅读 · 1 评论 -
判断字符串是否为回文(c语言)
问题:编写一个程序;实现 输入一串字符串,判断它是否是回文;运行图:源代码:#include <stdio.h>#include <string.h>int Hwen( char *str ){ int j ; j = strlen(str) ; return j ;}原创 2022-02-01 16:33:26 · 5223 阅读 · 0 评论 -
求最大公约数和最小公倍数(c语言)
问题:编写一个程序,输入两个正整数,实现输出两个正整数的最大公约数和最小公倍数的功能;运行效果图:程序源代码:#include <stdio.h>#include <math.h>int main(){ int a = 0; int b = 0; int c = 0; int d = 0; printf( "请输入两个正整数:") ; scanf("%d %d",&a,&b); //最大公约数 for( c =原创 2022-01-31 16:03:25 · 1026 阅读 · 0 评论 -
计算两个日期差多少天
问题:编写一个程序,输入两个日期,输出两个日期差多少天;运行图:源代码:#include <stdio.h>struct A{ int a; int b; int c;};int main(void){ int i,j,m,g[2],k=0,l; char s[12]={31,28,31,30,31,30,31,31,30,31,30,31}; struct A stu[2]; //printf("%d %d",g[0],g[1]); for(i=0;原创 2022-01-30 16:07:47 · 489 阅读 · 0 评论 -
输出边长为n的正六边形(c语言)
问题:编写一个程序,输入一个正整数 n;输出边长为n的正六边形;运行图:源代码:#include <stdio.h>int main(){ int a,i,j,t; scanf("%d",&a); for(i=1;i<=2*a-1;i++) { if(i==1||i==2*a-1) { for(j=0;j<a-1;j++) printf(" ".原创 2022-01-29 17:01:38 · 4501 阅读 · 0 评论 -
回文数(c语言)
回文数概念:给定一个数,这个数顺读和逆读都是一样的。例如:121,1221是回文数,而123,1231不是回文数。解决问题:输入两个正整数, 输出两个正整数之间的回文数;运行图:源代码:#include <stdio.h>#include <stdlib.h>#include <math.h>int loop(int x){ int i = 0,; int t = x; char s[16]; do {原创 2022-01-28 16:53:41 · 5462 阅读 · 0 评论 -
十进制转换为其他进制(c语言)
十进制转换为二进制运行图:源代码:#include <stdio.h>/*10进制转换为2进制*/void conversion(int a){ int chu, yu; chu=a/2; yu=a%2; if(chu==0) { printf("%d",yu); } else { conversion(chu); printf("%d",yu); }}int main(void){ int x; prin.原创 2022-01-27 18:06:57 · 6479 阅读 · 1 评论 -
单链表的基本运算
单链表的基本运算:查询节点,删除节点等:运行图:源代码:#include <stdio.h>#include <stdlib.h>typedef struct on{ int data; struct on* next ;} Slinknode;void list(Slinknode*& L){ L = (Slinknode*)malloc(sizeof(Slinknode));}void Create(Slinknode * &a.原创 2022-01-26 20:22:10 · 1048 阅读 · 0 评论 -
约瑟夫问题
约瑟夫问题,n个人站成一圈,第m个出列;运行图:代码:#include <stdio.h>#include <stdlib.h>#define max 100typedef struct{ int data[max]; int front; int count;}Sqlint;void Int(Sqlint& qu){ qu.count = qu.front = 0;}void des(Sqlint qu){ }int enq.原创 2022-01-25 15:52:59 · 481 阅读 · 0 评论 -
排序算法(冒泡、选择、插入)
1、冒泡排序int k1 = 0, i, j;double m,k2;double a[100],b[100];for (i = 0; i < k1; i++) //冒泡排序{ for (j = k1 - 1; j >i; j--) { if (a[j] < a[j - 1]) { m = a[j - 1]; a[j - 1] = a[j]; a[j] = m; k2 = b[j - 1];原创 2022-01-24 20:07:08 · 333 阅读 · 0 评论 -
极限、可导、可微、连续之间的关系
基本初等函数的导数公式(1) (C)'=0 ,C是常数(2) (xα)'=αxα-1(3) (ax)'=axlna,特别地,当a=e时,(ex)'=ex(4) (logax)'=1xlna, 特别地,当a=e时,(lnx)'=1x(5) (sinx)'=cosx(6) (cosx)'=-sinx基本初等函数的微分公式(1)、dc=0(c为常数);(2)、d(xμ)=μxμ-1dx(μ为任意常数);(3)、d(ax)=a...原创 2022-01-23 19:14:20 · 3625 阅读 · 0 评论 -
极限的计算方法总结
极限的计算方法一、初等函数:1.limC=C(C是常值函数);2.若 fx≤M(即fx是有界量),limα=0(即α是无穷小量),⇒limfx⋅α=0,特别:fx=C⇒limC⋅α=0 ;3.若 fx≤M(即fx是有界量)⇒limfx∞=0,特别 :fx=C C≠0⇒limC∞=0 ;4.limC0=&+∞C>0&-∞C<0;5.未定式 ;A.分子 , 分母含有相同的零因式 , 消去零因式 ;B.等价无穷小替换(常用sinx~x,ex-1...原创 2022-01-22 23:02:09 · 8032 阅读 · 0 评论 -
初等数学基础知识
一、三角函数1.公式同角三角函数间的基本关系式:·平方关系: sin^2(α)+cos^2(α)=1;tan^2(α)+1=sec^2(α);cot^2(α)+1=csc^2(α)·商的关系: tanα=sinα/cosα cotα=cosα/sinα·倒数关系: tanα·cotα=1; sinα·cscα=1; cosα·secα=1 三角函数恒等变形公式:·两角和与差的三角函数:cos(α+β)=cosα·cosβ-sinα...原创 2022-01-20 12:52:01 · 1958 阅读 · 0 评论