CPP 주민등록번호 분석기

실습과제 모음 2012. 7. 23. 15:24 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

#include <iostream>

using namespace std;

int main()

{   

     char juminnumber[15];

     cout <<"주민등록번호입력(-없이입력하세요) : ";

     cin>>juminnumber;

     if(juminnumber[6]=='1' || juminnumber[6]=='2')

     {

           cout <<"당신의생년월일은"<<juminnumber[0]<<juminnumber[1]<<""<<juminnumber[2]<<juminnumber[3]<<""<<juminnumber[4]<<juminnumber[5]<<"일입니다"<<endl;

     }

     else

     {

           cout <<"당신의생년월일은"<<juminnumber[0]<<juminnumber[1]<<""<<juminnumber[2]<<juminnumber[3]<<""<<juminnumber[4]<<juminnumber[5]<<"일입니다"<<endl;

     }

     int temp = 0;

     temp = (juminnumber[7] - '0')*10;

     temp += juminnumber[8] - '0';

     if(temp<10)

     {

           cout<<"서울사람입니당"<<endl;

     }

     else if(9<temp && temp<14)

     {

           cout<<"부산사람입니당"<<endl;

     }

     else if(13<temp && temp<17)

     {

           cout<<"인천사람입니당"<<endl;

     }

     else if(22<temp && temp<26)

     {

           cout<<"강원도사람입니당"<<endl;

     }

     else if(24<temp && temp<48)

     {

           cout<<"충청도사람입니당"<<endl;

     }

     else if(48<temp && temp<67)

     {

           cout<<"전라도사람입니당"<<endl;

     }

     else if(66<temp && temp<99)                              

     {                                        

           cout<<"경상도사람입니당"<<endl;          

     }                                                        

     return 0; 

}                                                                   

 

 

 

'실습과제 모음' 카테고리의 다른 글

CPP 함수 cvr, cba, cbv  (0) 2012.07.24
CPP 실습과제 0724 배열, 함수  (0) 2012.07.24
CPP Chapter 03 실습  (0) 2012.07.23
CPP 0722 실습과제  (0) 2012.07.22
방학특강 C 언어 주말과제 0720~0723  (0) 2012.07.20