c++ 结构体demo

笔记 

struct.cpp#include <iostream>using namespace std;struct inflatable{ string name; int age; float weight;};struct new_struct{ string n

C求字符串中出现次数最多的数还有出现的次数

笔记 

#include <stdio.h>const int N = 1000000;char ch[N];int main(){ gets(ch); int count[127]={0}; for(int i=0; ch[i]; i++) count[ch[i]]++;

c++求字符串长度


//字符串长度#include <iostream>#include <string>using namespace std;int main(){ string str; getline(cin, str); int len = str.length();

99乘法表


#include <cstdio>int main(void) { for(int i = 1;i<=9;i++){ for(int j = 1;j<=i;j++){ printf("%d x %d = %d ",

输出菱形作业

笔记 

#include <cstdio>int main(void) { for(int i = 1;i<=4;i++){ for(int j = 1;j<=4-i;j++){ printf(" "); }

数组的插入,删除---线性表的插入,删除


数组的插入#include <iostream>using namespace std;int main(void) { char arr[5] = {'a','b','c','d','e'};

选择排序使用


#include <iostream>using namespace std;void select_sort(int a[],int length){ for(int i = 0;i<=length-1;i++){ for(int j = i+1;j<=

数组翻转题解


#include <iostream>using namespace std;void reverse(int a[],int size);int main(void) { int n,size; cin >> n >> size; int a[

最小公约数题解


#include <iostream>using namespace std;int lcm(int a,int b);int main(void) { int a,b; cin >> a >> b; int m = lcm(a,b); c

最大公约数-题解(语法题)


更相减损术https://baike.baidu.com/item/更相减损术/449183c++ 代码#include <iostream>using namespace std;int gcd(int a,int b){ while(a != b) { if (a