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

C/C++ Q/A
[3310] 구조체에 대해서..
이제시작~ [] 1189 읽음    2004-04-10 22:58
제가 짠 프로그램인데요..성적프로그램이라기 보다는 그냥 단순한 구조체 출력문제인데요..
여기서 총점이랑 평균이 이상한 수로 나와서요..
아참 그리고 cout을 할때 꼭 하나하나 출력하지 않고 짜여진 하나만을 가지고 위의 입력자료를 출력하는
것은 안되는건가요?
이제 C/C++을 시작하는 단계라서 엉망이예요..C부터할려다가 C++부터 하게되었는데요..
어차피 둘다 해야되는데 아는게 없어서 엉망이예요..앞으로 여러가지 도와주세요^^

#include <iostream.h>
struct sungjuk
{
  char name[10];
  int kor;
  int eng;
  int math;
  int tot;
  float ave;
};

int main()
{
  sungjuk no1=
  { "Jon", 78, 90, 65, no1.kor + no1.eng + no1.math, no1.tot/3 };

  sungjuk no2=
  { "Jane", 95, 90, 88, no2.kor + no2.eng + no2.math, no2.tot/3 };

  sungjuk no3=
  { "Kane", 85, 80, 75, no3.kor + no3.eng + no3.math, no3.tot/3 };

  sungjuk no4=
  { "Susin", 99, 83, 77, no4.kor + no4.eng + no4.math, no4.tot/3 };

  sungjuk no5=
  { "Buny", 97, 79, 95, no5.kor + no5.eng + no5.math, no5.tot/3 };


  cout << "5명의 성적 자료입니다.\n";
  cout << "이름 국어 영어 수학 총점 평균 \n";
  cout << no1.name << "   " << no1.kor << "   " << no1.eng << "   " << no1.math
       << "  " << no1.tot << " " << no1.ave << "\n";

  cout << no2.name << "  " << no2.kor << "   " << no2.eng << "   " << no2.math
       << "  " << no2.tot << " " << no2.ave << "\n";

  cout << no3.name << "  " << no3.kor << "   " << no3.eng << "   " << no3.math
       << "  " << no3.tot << " " << no3.ave << "\n";

  cout << no4.name << " " << no4.kor << "   " << no4.eng << "   " << no4.math
       << "  " << no4.tot << " " << no4.ave << "\n";

  cout << no5.name << "  " << no5.kor << "   " << no5.eng << "   " << no5.math
       << "  " << no5.tot << " " << no5.ave << "\n";
      
  return 0;
}

+ -

관련 글 리스트
3310 구조체에 대해서.. 이제시작~ 1189 2004/04/10
3311     Re:구조체에 대해서.. 김시환 1214 2004/04/11
3314         Re:Re:구조체에 대해서.. 이제시작~ 1226 2004/04/12
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.