Views 7666 Votes 0 Comment 0
Atachment
Attachment '1'
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
구조체 배열에 학생 성적 입력 받아서..
총점,평균 계산해서 파일 출력하는 간단한.. ㅋㄷ
상언아~ 좋지? ㅋㄷ

입력 받고 출력하는 주요 함수

/* 점수 받아옴 (도중에 exit 나 그냥 엔터 치면 종료) */
void get_marks(){
    int i;
    char tmp[LEN]={0,};

    for(i=0; i<ARR; i++){
        printf("\n## %d 번째 학생 ##\n", i+1);
        printf("학    번 : ");
        fgets(tmp, LEN, stdin);
        if(isexit(tmp)) return;
        strcpy(std[i].hak, tmp);

        printf("이    름 : ");
        fgets(tmp, LEN, stdin);
        if(isexit(tmp)) return;
        strcpy(std[i].name, tmp);

        printf("리 눅 스 : ");
        fgets(tmp, LEN, stdin);
        if(isexit(tmp)) return;
        std[i].lin=atol(tmp);

        printf("프로그램 : ");
        fgets(tmp, LEN, stdin);
        if(isexit(tmp)) return;
        std[i].pro=atol(tmp);

        std[i].total=std[i].lin + std[i].pro;
        std[i].avg=(std[i].lin + std[i].pro) / 2;

        /* 출력할 때 몇 개 출력할건지 루프 돌아야 하는 카운트 */
        num++;
    }
}

/* 파일로 출력하는 함수 */
void print_marks(){
    FILE *fp;
    int i;

    /* 파일 열기 */
    if((fp=fopen("data.dat","w"))==NULL){
        printf("\nfile open error!\n\n");
        return;
    }

    fprintf(fp, "## 결과 ## \n");
    fprintf(fp, "%s\t %8s\t% 4s\t %4s\t %4s\t %4s\n","학번","성명","리눅스", "프로그램", "총점", "평균");
    for(i=0; i<num; i++){
        fprintf(fp, "%s\t %8s\t %5.0f\t %8.0f\t %4.0f\t %4.2f\n",
            std[i].hak, std[i].name, std[i].lin, std[i].pro, std[i].total, std[i].avg
            );
    }
    fclose(fp);

    printf("\n결과가 data.dat 파일로 출력되었습니다\n\n");
}

?

  1. [Android Error] The number of method references in a .dex file cannot exceed 64K

    Date2016.11.10 CategoryDevelop Byhooni Views756
    Read More
  2. [ajax] 이벤트 코드 생성기 작업중.. ㅋㅋ

    Date2013.04.23 CategoryDevelop Byhooni Views7116
    Read More
  3. [ajax] 샘플 코드와 한글처리에 대한 간단한 설명

    Date2013.04.23 CategoryDevelop Byhooni Views6842
    Read More
  4. ZBar 라이브러리를 이용한 바코드 스캔 앱 개발하기

    Date2015.01.01 CategoryDevelop Byhooni Views1628
    Read More
  5. XML, JSON, BSON, MSGPACK 장,단점 비교

    Date2017.01.11 CategoryDevelop Byhooni Views2244
    Read More
  6. XE Core 1.8.18 본문 작성시 태그(html) 사라지는 버그

    Date2016.04.21 CategoryDevelop Byhooni Views868
    Read More
  7. What is difference between Get, Post, Put and Delete?

    Date2018.02.28 CategoryDevelop Byhooni Views1407
    Read More
  8. URI 인코딩, URL 인코딩

    Date2013.04.23 CategoryDevelop Byhooni Views18847
    Read More
  9. SVN 초간단 사용하기

    Date2014.02.28 CategoryDevelop Byhooni Views7618
    Read More
  10. SVN 명령어 (SVN command)

    Date2014.02.28 CategoryDevelop Byhooni Views12144
    Read More
  11. OPT와 CAS에 대한 자료.. (교수님 메일로 보내드린 자료..)

    Date2013.04.23 CategoryDevelop Byhooni Views13923
    Read More
  12. OpenGL 강좌 사이트 모음

    Date2013.04.23 CategoryDevelop Byhooni Views9637
    Read More
  13. OGNL(Object Graph Navigation Language)

    Date2013.04.23 CategoryDevelop Byhooni Views15729
    Read More
  14. macOS에 node, npm 설치하기 (homebrew)

    Date2021.11.06 CategoryDevelop Byhooni Views1145
    Read More
  15. Mac OS 에 Jenkins 설치하기 (Homebrew)

    Date2017.03.15 CategoryDevelop Byhooni Views8106
    Read More
  16. Laravel 5 Failed opening required bootstrap/../vendor/autoload.php

    Date2018.01.24 CategoryDevelop Byhooni Views1660
    Read More
Board Pagination Prev 1 ... 49 50 51 52 53 Next
/ 53