주민번호 참고소스
페이지 정보
본문
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
#define true 1
#define false 0
void check_ju(int *org,int *input);
int make_int(char);
void gotoxy(int x, int y);
void main()
{
int i;
int check;
int ju[13];
int str[13]={2,3,4,5,6,7,8,9,2,3,4,5,0};
//for(i=0;i<13;i++)printf("%d ",str[i]); str 값 확인
printf("주민등록:");
printf("###### - #######");
for(i=0;i<13;i++){
if(i<6){
gotoxy(9+i,0);
ju[i]=make_int(getche());
if(ju[2]>1)check=false;
else if(ju[2]==1 && ju[3]>2)check=false;
else if(ju[4]>3) check=false;
else if(ju[4]==3 && ju[5]>1)check=false;
else check=true;
}
else{
gotoxy(9+i+3,0);
ju[i]=make_int(getche());
gotoxy(9+i+3,0);
printf("*");
}
}
// for(i=0;i<13;i++)printf("\n%d %d ",str[i],ju[i]); 비교값,주민번호 찍기
if(check==true) check_ju(str,ju);
else printf("\n다시 확인하여주세요");
getch();
}
void check_ju(int *org,int *input)
{
int i,sum=0;
for(i=0;i<12;i++,*org++,*input++)sum =sum+ *org * *input;
if((11-(sum%11))%10==*input)printf("\n정상입니다.\n");
else printf("\n주민번호가 잘못되었습니다.?\n");
}
int make_int(char a)
{
return a-48;
}
void gotoxy(int x, int y)
{
COORD Pos = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
#define true 1
#define false 0
void check_ju(int *org,int *input);
int make_int(char);
void gotoxy(int x, int y);
void main()
{
int i;
int check;
int ju[13];
int str[13]={2,3,4,5,6,7,8,9,2,3,4,5,0};
//for(i=0;i<13;i++)printf("%d ",str[i]); str 값 확인
printf("주민등록:");
printf("###### - #######");
for(i=0;i<13;i++){
if(i<6){
gotoxy(9+i,0);
ju[i]=make_int(getche());
if(ju[2]>1)check=false;
else if(ju[2]==1 && ju[3]>2)check=false;
else if(ju[4]>3) check=false;
else if(ju[4]==3 && ju[5]>1)check=false;
else check=true;
}
else{
gotoxy(9+i+3,0);
ju[i]=make_int(getche());
gotoxy(9+i+3,0);
printf("*");
}
}
// for(i=0;i<13;i++)printf("\n%d %d ",str[i],ju[i]); 비교값,주민번호 찍기
if(check==true) check_ju(str,ju);
else printf("\n다시 확인하여주세요");
getch();
}
void check_ju(int *org,int *input)
{
int i,sum=0;
for(i=0;i<12;i++,*org++,*input++)sum =sum+ *org * *input;
if((11-(sum%11))%10==*input)printf("\n정상입니다.\n");
else printf("\n주민번호가 잘못되었습니다.?\n");
}
int make_int(char a)
{
return a-48;
}
void gotoxy(int x, int y)
{
COORD Pos = {x,y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos);
}
댓글목록
등록된 댓글이 없습니다.