
输入三个字符,找出其中一个ASCII值最大的输出来
4个回答
展开全部
1、创建测试表,
create table test_ascii(value varchar2(10));
2、插入测试数据
insert into test_ascii values('a');
insert into test_ascii values('b');
insert into test_ascii values('c');
3、查询表中所有记录数,select t.*, rowid from test_ascii t,
4、编写sql,查询每个字符的ascii值,并获取最大的ascii记录,
select * from (
select t.*, ascii(value) asc_value, row_number() over(order by ascii(value) desc) rn
from test_ascii t) where rn = 1
展开全部
1234567891011121314151617181920212223242526#include<stdio.h>#define N 3 int main(){ char arr[N]; printf("请输入3个字符: "); for (int i = 0; i < N; i++) arr[i] = getchar(); int max = 0; int index; for (int i = 0; i < N; i++){ if (max < arr[i]){ max = arr[i]; index = i; } } printf("\n最大的字符是 %c", arr[index]); getchar(); getchar(); return 0;}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2015-10-27 · 知道合伙人教育行家
关注

展开全部
#include<stdio.h>
#define N 3
int main(){
char arr[N];
printf("请输入3个字符: ");
for (int i = 0; i < N; i++)
arr[i] = getchar();
int max = 0;
int index;
for (int i = 0; i < N; i++){
if (max < arr[i]){
max = arr[i];
index = i;
}
}
printf("\n最大的字符是 %c", arr[index]);
getchar();
getchar();
return 0;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include<stdio.h>
int main()
{
char a,b,c,d;
printf("Please input 3 chars:\n");
scanf("%c %c %c",&a,&b,&c);
d=a;
if (b>d)d=b;
if (c>d)d=c;
printf("The max char is %c\n",d);
return 0;
}
例如,输入 Axc
输出: The max char is x
int main()
{
char a,b,c,d;
printf("Please input 3 chars:\n");
scanf("%c %c %c",&a,&b,&c);
d=a;
if (b>d)d=b;
if (c>d)d=c;
printf("The max char is %c\n",d);
return 0;
}
例如,输入 Axc
输出: The max char is x
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询