输入三个字符,找出其中一个ASCII值最大的输出来

如题所述

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

温馨提示:答案为网友推荐,仅供参考
第1个回答  2020-06-25
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;}
第2个回答  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;
}

本回答被提问者采纳
第3个回答  2015-10-27
#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本回答被网友采纳
相似回答