목록문자열제어 (2)
일상 코딩
[C++ / 아마존 기출] 문자열 제어 및 탐색, 숫자만 출력
#include using namespace std; // int main(){ // freopen("./06_extract_number/input.txt","rt",stdin); int main(int argc, char* argv[]){ freopen(argv[1], "rt", stdin); freopen(argv[2], "w", stdout); char a[100]; int res = 0, cnt = 0, i; cin >> a; for(i=0; a[i] != '\0';i++){ if(a[i] >= 48 && a[i]
C++/코딩테스트 대비
2021. 10. 13. 05:13

#include using namespace std; int main(){ freopen("./05_age_calcul/input.txt","rt",stdin); // 채점 프로그램 돌릴때 사용(mac 사용자 기준) // int main(int argc, char* argv[]){ // freopen(argv[1], "rt", stdin); // freopen(argv[2], "w", stdout); int age,year; char cnum[20],sex; // 주민등록번호 저장 cin >> cnum; if(cnum[7] == '1' || cnum[7] == '2'){ year = 1900 + ((cnum[0]-48)*10+(cnum[1]-48));} else{ year = 2000 + ((cnum[0..
C++/코딩테스트 대비
2021. 10. 13. 04:58