Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[1552] 님들같은 분이 있어서 혼자 시작하는 프로그래밍이 더욱 즐거워 지는거 같네요...암튼 고마워요..^^
고마워요...^^ [] 1288 읽음    2002-11-15 01:22
이영우 님이 쓰신 글 :
: 숙제가 아니시기를..
:
:
: #include <stdio.h>
:
: struct mark_rec
: {
:     int num;
:     char name[20];
:     int mark[5];
:
:     char  abcdf[5];
:     float total_100;
:     float total_45;
: };
:
: void mark_rec1(struct mark_rec student[]);
: void mark_rec2(struct mark_rec student[]);
: void mark_rec3(struct mark_rec student[]);
:
:
: void main (void)
: {
:     int i,j;
:
:     struct mark_rec student[5] = {
:         {1,"강감찬", 70, 80, 92, 90, 95, 0.0, 0.0},
:         {2,"이순신",100, 90, 95, 95, 99, 0.0, 0.0},
:         {3,"권율  ", 80, 65, 79,100, 95, 0.0, 0.0},
:         {4,"에디슨", 80, 90, 92, 92, 97, 0.0, 0.0},
:         {5,"장보고", 85, 78, 90, 77, 95, 0.0, 0.0}
:     } ;
:    
:     mark_rec1(student);
:     mark_rec2(student);
:     mark_rec3(student);
:    
:     printf("\t 국어   수학   영어   과학   실험   평균  평점 \n");
:     printf("\t-----------------------------------------------\n");
:     for (i=0;i<5;i++)
:     {
:         printf("%d %s",student[i].num,student[i].name);
:         for(j=0;j<5;j++)
:             printf(" %3d %c,",student[i].mark[j],student[i].abcdf[j]);
:         printf(" %3.1f  %1.2f",student[i].total_100,student[i].total_45);
:         printf("\n");
:     }
:    
: }
:
: void mark_rec1(struct mark_rec student[])
: {
:     int i,j;
:     for(i=0;i<5;i++) {
:         for(j=0;j<5;j++)
:             if (student[i].mark[j]>=90)
:                 student[i].abcdf[j]='A';
:
:             else if(student[i].mark[j]>=80 && student[i].mark[j]<90)
:                 student[i].abcdf[j]='B';
:
:             else if(student[i].mark[j]>=70 && student[i].mark[j]<80)
:                 student[i].abcdf[j]='C';
:
:             else if(student[i].mark[j]>=60 && student[i].mark[j]<70)
:                 student[i].abcdf[j]='D';
:
:             else
:                 student[i].abcdf[j]='F';
:            
:     }
: }
:
: void mark_rec2(struct mark_rec student[])
: {
:     int i,j;
:    
:     for(i=0;i<5;i++) {
:         for(j=0;j<5;j++)
:             student[i].total_100 += student[i].mark[j];
:         student[i].total_100 /= 5;
:     }
: }
:
: void mark_rec3(struct mark_rec student[])
: {
:     int i,j;
:
:     for(i=0;i<5;i++) {
:         for(j=0;j<5;j++)
:             if(student[i].abcdf[j]=='A')
:                 student[i].total_45 += 4;
:
:             else if(student[i].abcdf[j]=='B')
:                 student[i].total_45 += 3;
:
:             else if(student[i].abcdf[j]=='C')
:                 student[i].total_45 += 2;
:
:             else if(student[i].abcdf[j]=='D')
:                 student[i].total_45 += 1;
:
:             else
:                 student[i].total_45 += 0;
:         student[i].total_45 /= 5;
:     }
: }
:
:
: 왕초보...ㅡㅜ 님이 쓰신 글 :
: : 입력받은 점수로 학점과 학점 평균을 내는 프로그램인데요...
: :
: : 구조체를 다른 함수로 넘기는 것을 잘 모르겠습니다....
: :
: : 하다가 하다가 진도가 나가지 않아서요...마니 고쳐보았는데...
: :
: : 이것 저것 고치다 보니까 이제 어떻게 해야 할지 모르겠습니다...에러하고 경고
: :
: : 가 너무 많이 나와서...고수님들 좀금 귀찬겠지만 조금만 도움을 주시면 안될까요...
: : #include <stdio.h>
: : struct mark_rec
: : {
: :  int num;
: :  char name[20];
: :  int mark[5];
: : };
: :
: : void main (void)
: : {
: :  int i,j,total;
: :  struct mark_rec student[5]=
: :  {
: :  1,"강감찬",70,80,92,90,95,
: :  2,"이순신",100,90,95,95,99,
: :  3,"권율`  ",80,65,79,100,95,
: :  4,"에디슨",80,90,92,92,97,
: :  5,"장보고",85,78,90,77,95
: :  };
: :
: :  struct  mark_rec mark_rec2(struct mark_rec[]);
: :  mark_rec mark_rec2(student);
: :  struct mark_rec2 mark_mark3(struct mark2_rec[]);
: :  mark_rec2 mark_rec3(student);
: :
: :  printf("\t 국어 수학 영어 과학 실험 평점 \n");
: :  for (i=0;i<5;i++)
: :  {
: :  printf("%d %s",student[i].num,student[i].name);
: :  for(j=0;j<5;j++)
: :  printf("%c %d",student[i].mark[j],total[i]/5);
: :  printf("\n");
: :  }
: :
: : }
: : struct mark_rec mark_rec2(struct mark_rec student[5])
: : {
: :  int i,j;
: :  for(i=0;i<5;i++)
: :  {
: :   for(j=0;j<5;j++)
: :   if (student[i].mark[j]>=90)
: :   {student[i].mark[j]='A';}
: :   else if(student[i].mark[j]>=80 && student[i].mark[j]<90)
: :   {student[i].mark[j]='B';}
: :   else if(student[i].mark[j]>=70 && student[i].mark[j]<80)
: :   {student[i].mark[j]='C';}
: :   else if(student[i].mark[j]>=60 && student[i].mark[j]<70)
: :   {student[i].mark[j]='D';}
: :   else
: :   {student[i].mark[j]='F';}
: :   return(student);
: :  }
: : }
: : struct mark_rec2 mark_rec3(struct mark_rec2 student[5])
: : {
: : int i,j;
: : int total[5];
: : for(i=0;i<5;i++)
: : {
: :  for(j=0;j<5;j++)
: :  if(student[i].mark[j]=='A')
: :  student[i].mark[j]=4;
: :  if else(student[i].mark[j]=='B')
: :  student[i].mark[j]=3;
: :  if else(student[i].mark[j]=='C')
: :  student[i].mark[j]=2;
: :  if else(student[i].mark[j]=='D')
: :  student[i].mark[j]=1;
: :  if else
: :  student[i].mark[j]=0;
: : }
: : for(i=0;i<5;i++){
: : for(j=0;j<5;j++)
: : total[i]+=student[i].mark[j];}
: : return(total);
: : }
: :

+ -

관련 글 리스트
1542 입력받은 점수로 학점과 학점 평균을 내는 프로그램인데요... 왕초보...ㅡㅜ 1620 2002/11/14
1546     Re:입력받은 점수로 학점과 학점 평균을 내는 프로그램인데요... 이영우 1380 2002/11/14
1552         님들같은 분이 있어서 혼자 시작하는 프로그래밍이 더욱 즐거워 지는거 같네요...암튼 고마워요..^^ 고마워요...^^ 1288 2002/11/15
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.