题解列表

筛选

海伦公式计算三角形面积

摘要:解题思路:注意事项:计算值要设置为double参考代码:#include<stdio.h>#include<math.h>double distance(float x1, float y1, flo……

C语言训练-"水仙花数"问题2

摘要:解题思路:分别求各个位数的数字,再分别求立方,最后加起来的和看是否与给定的值相等注意事项:求百位:num/100;               求十位:num/10%10;              ……

c语言利润计算

摘要:解题思路:分支(小白适用)注意事项:各个分段之间的练习参考代码:#include<stdio.h>int main() { int sal=0; int I; scanf("%d",&I); if(I……

就要和别人不一样

解题思路:如果没完没了怎么办?我们构造一个函数,一个名为`run`的函数。创建了一个列表`ranges`,其中包含了多个元组。每个元组包含两个值,第一个值是利润上限`limit`,第二个值是对应的提成率`rate`。这些元组表示了不同的利润范围和对应的提成率。

字符串连接

```cpp#includeusingnamespacestd;intmain(){strings,t;getline(cin,s);getline(cin,t);//字符串输入函数for(inti=0;i

字符大法好

摘要:解题思路:用字符串一个一个取出来注意事项:特别注意就是别想复杂了,一般数学取数字问题多多考虑字符串参考代码:#include <iostream>#include <stdio.h>using nam……

一种利用switch_case特性的巧妙解法

摘要:# 一种利用switch_case特性的巧妙解法——减少代码量 ## 传统写法 各种写法很多,这儿提供一种典型的: ```c #include int main() { int ……

2918:成绩排序

```c#include#includetypedefstructstudent{charname[25];intscore;}student;intmain(){intn=0,i=0,j=0;studentstu[20]={0};studenttemp;scanf("%d",