欢迎来到牛牛题库网 牛牛题库官网
logo

未知题型

请编写函数fun(),对长度为7个字符的字符串,除首、尾字符外,将其余5个字符按ASCII码值降序排列。
例如:原来的字符串为CEAedca,则排序后输出为CedcEAa。
注意:部分源程序已存在文件test22_2.cpp中。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。
文件test22_2.cpp的内容如下:
include <iostream.h>
include <stdio.h>
include <ctypE.h>
include <conio.h>
void int fun(char *s, int num)
{
}
void main ( )
{
char s[10];
printf ('输入7个字符的字符串:');
gets(s);
fun(s,7);
cout<<s;
}

A.cpp中。
B.cpp的内容如下:
C.h>
D.h>
E.h>
F.h>
【参考答案】

int fun(char*sint num) {char t; int ij; for(i=1;i<num-2;i++)......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)

点击查看答案
微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题