当前位置:网站首页>Character sorting in the string (10 points): please write the function fun to sort the strings with a length of 8 characters in descending order.
Character sorting in the string (10 points): please write the function fun to sort the strings with a length of 8 characters in descending order.
2022-04-21 13:41:00 【Tomatos_ baby】
Please write a function fun The length is 8 Strings of characters are arranged in descending order .
Function interface definition :
int fun(char s[],int num);
among s and num All parameters passed in by the user . Function pair length is num String s Sort in descending order .
Sample referee test procedure :
#include<stdio.h>
int fun(char s[],int num);
int main()
{ char s[10];
gets(s);
fun(s,8);
printf("%s\n",s);
return 0;
}
/* Please fill in the answer here */
sample input :
azxscdvf
sample output :
zxvsfdca
int fun(char s[],int num)
{
int i,j,plag;
for(i=0;i<num;i++)
{
for(j=0;j<i;j++)
{
if (s[i] > s[j])
{
s[i] = s[j] + s[i];
s[j] = s[i] - s[j];
s[i] = s[i] - s[j];
}
}
}
}
版权声明
本文为[Tomatos_ baby]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204211340248493.html
边栏推荐
- Detailed explanation of Flink related API development and operation architecture and implementation principle
- 建议:ALT+X 标注已标注的区域,是否可以取消标注呢?
- 哈夫曼編碼
- 程序员爆出自己的薪资税前月薪15000
- Could not load dynamic library ‘libcusolver.so.11‘
- Basic practice questions and answers of economic law in 2022 primary accounting title examination
- In office word 2016, omml2mml appears when the formula edited by word's own formula editor is transferred to MathType Solutions to XSL problems
- Servlet中关于web.xml的测试
- Tailwind核心理念——响应式设计
- leetcode:824. 山羊拉丁文【简单字符串操纵】
猜你喜欢

Wang Baiping: my way to envoy maintainer

Small and medium-sized manufacturing enterprises transformation capacity-building sharing

2022 supervision engineer contract management exercises and answers

【栈和队列专题】—— 双队列模拟栈

flink-1.12.0版Yarn安装部署

Accounting practice exercises and answers for the 2022 primary accounting title examination

idea自动生成单元测类

Basic practice questions and answers of economic law in 2022 primary accounting title examination

SECOND: Sparsely Embedded Convolutional Detection

How many insurance evaluation companies are there in Haikou? Where is it specificly? Where can I find it?
随机推荐
Achieve random labels, font size, color random display
专家系统实例及其骨架系统
运动耳机什么样的舒服、运动健身耳机推荐
HCIP之路ospf的选路,防环,重发布
Peking University ACM problems 1010: stamps
Peking University ACM problems 1009: edge detection
滚动条样式修改
Ali Tianchi competition -- street view character coding recognition
过滤字符串只保留串中的字母字符 (10 分)请编写一个函数fun,函数的功能是:输入一个字符串,过滤此串,只保留串中的字母字符,并统计新生成串中包含的字母个数。
一级等保怎么做?要收费吗?等保要求是什么?
哈夫曼编码
Exercise questions and answers of basic theories and relevant laws and regulations in 2022 supervision engineer examination
leetcode:513. Find the value in the lower left corner of the tree [simply BFS find the first one in each layer]
MySQL学习笔记-day03
leetcode:824. Goat Latin [simple string manipulation]
[csnote] DB exception (redundant data, modification exception, deletion exception, insertion exception)
Dynamic implementation of address book
echart常见的配置项(线、区域、文本)
Exercise questions and answers of quality, investment and progress control in 2022 supervision engineer examination
SECOND: Sparsely Embedded Convolutional Detection