77问答网
所有问题
当前搜索:
字符串排序输入5个字符串
设计一个算法,列出一个由
5个
不同字符组成的
字符串
中的字符的其他可能排...
答:
i]; } cout<<endl; return; } for(int i=k;i<n;++i) { myswap<char>(p,k,i); Perm(p,k+1,n); myswap<char>(p,k,i); }} int main(){ char a[6]="world"; Perm(a,0,5)
用C语言从键盘循环
输入字符5个字符串
答:
void main (){ char
string
[
5
];int i;char max,min,choice;for(i=0;i<5;i++){ scanf("%c",&string[i]);} max = string[0];for(i=1;i<5;i++)if(strcmp(max,string[i]<0){ choice = max;max = string[i];string[i] = choice;} printf("%c",max);//最小的同理 ...
编写程序,
输入五个字符串
,输出其中最长的字符串。要求使用指针数组实 ...
答:
include <stdio.h> include <
string
.h > int main(){ int i = 0;char s[80] = {""}, max[80] = {""};printf("
输入五个字符串
:\n");scanf("%s",s);strcpy(max,s);for(i=1; i<5; i++){ scanf("%s",s);if( strcmp(max,s)<0 )strcpy(max,s);} printf("最大的...
二级指针 对
5个字符串排序
答:
strcpy(*(p+k),temp);是不能实现交换的。。纯C语言用malloc()这个函数实现。它的头文件是#include<stdlib.h> 还有你scanf("%s\n",*(p+i)); 你应该是想输出吧,写成
输入
了。。改成我这样就可以了 include<stdio.h> include<stdlib.h> include<
string
.h> void main(){ char a[5][100]...
我想编个c语言,可以依次
输入5个
名字,并
排序
,我编的程序如下,求指正...
答:
include <stdio.h> include <
string
.h> include <conio.h> int main() { char name[5][21],t[21];int i,j,k;for(i = 0;i < 5;i++) gets(name[i]);for(i = 0;i < 4;i++) { // 选择
排序
k = i;for(j = i + 1;j < 5;j++)if(strcmp(name[k],name[j]) >...
怎么用java实现输出a,b,c,d,e
五个字符
的所有可能
的排列
答:
change(j2,temp
String
);} for(int l=0;l0;j--)...{ all=all*j;} return all;} public void change(int i,String[] tempString)...{// String t="";t=tempString[i];tempString[i]=tempString[i+1];tempString[i+1]=t;} public static void main(String[] args)...{ FullA...
输入5个字符串
,输出其中最长的字符串。
答:
#include<stdio.h> #include<
string
.h> int main(){ int i=0;char s[80]={""},max[80]={""};printf("
输入五个字符串
:\n");scanf("%s",s);strcpy(max,s);for(i=1;i<5;i++){ scanf("%s",s);if(strcmp(max,s)<0)...
C语言找出最长的字符串。
输入5个字符串
,输入其中最长的字符串。
答:
include <stdio.h> include <
string
.h > int main(){ int i = 0;char s[80] = {""}, max[80] = {""};printf("
输入五个字符串
:\n");scanf("%s",s);strcpy(max,s);for(i=1; i<5; i++){ scanf("%s",s);if( strcmp(max,s)<0 )strcpy(max,s);} printf("最大的...
C语言题目找出最长的字符串.
输入5个字符串
,输出最长的那个字符串。输入...
答:
只要求输出最长的,所以没有必要把
5个字符串
都存储下来。举例如下://#include "stdafx.h"//If the vc++6.0, with this line.#include "stdio.h"#include "string.h"int main(void){ char a[100],la[100],i; printf("please enter 5
strings
...\n"); for(*la='\0',i=...
C语言:.
输入5个字符串
,输出最长的字符串.
答:
include<stdio.h> include<
string
.h> void main(){ char str[5][1001];int k[5],t=0;for(int i=0;i<5;i++){ gets(str[i]);k[i]=strlen(str[i]);if(k[i]>t){ t=k[i];} } for(i=0;i<5;i++){ if(t==k[i])puts(str[i]);} printf("\n");} ...
棣栭〉
<涓婁竴椤
4
5
6
7
9
10
8
11
12
13
涓嬩竴椤
灏鹃〉
其他人还搜