티스토리 뷰
JSP 랭킹구하기 / 순위 구하기
JSP 랭킹구하기 / 순위 구하기
|
<body>
<%!
//[0][0] = 자바 [1][0] = 웹프로그래밍 [2][0] = 안드로이드
int score[][] = new int [3][1]; //과목 점수
int rank[][] = {{1},{1},{1}}; // 랭킹
int sum; //총합
float ave; // 평균
int temp;
%>
<%
request.setCharacterEncoding("UTF-8"); //인코딩 한글
score[0][0] = Integer.parseInt(request.getParameter("java"));
score[1][0] = Integer.parseInt(request.getParameter("webp"));
score[2][0] = Integer.parseInt(request.getParameter("android"));
sum = score[0][0] + score[1][0] + score[2][0];
ave = sum / 3;
//랭킹구현
for(int i=0; i<3; i++){
temp=score[i][0];
for(int j=0; j<3; j++){
if(temp < score[j][0]){
rank[i][0]++; //자신보다 높은 점수가 있다면 랭킹 +1
}
}
}
%>
</body>
'It' 카테고리의 다른 글
국제금융시장의 현황과 주요 변화 (0) | 2022.08.24 |
---|---|
국제금융시장의 구성과 참가자 (0) | 2022.08.24 |
RIP - OSPF 혼합된 네트워크, 재분배(Redistribute) (0) | 2022.08.24 |
구글 성인인증 (우회) 방법 (0) | 2022.08.23 |
영국 구글 우회/호주 구글 우회/일본 구글 우회/구글 우회접속 (0) | 2022.08.23 |
댓글
Blog is powered by
Tistory / Designed by
Tistory