CPP 표준체중 계산 프로그램

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

#include <iostream>

using namespace std;

class standardWeight

{

private:

   double  height, weight;

   int  WeightStatus;

public:

   void  setHeight(const double h);

   void  setWeight(const double w);

   double  getHeight();

   double  getWeight();

   int  StdWeight();

   int  getWeightStatus();

};

void  standardWeight::setHeight(const double h)

{

   height = h;

}

void  standardWeight::setWeight(const double w)

{

   weight = w;

}

double  standardWeight::getHeight()

{

   return height;

}

double  standardWeight::getWeight()

{

   return weight;

}

int  standardWeight::StdWeight()

{

   if(   (height - 100) * 0.9 < weight )

   {

       // 과체중

       WeightStatus = 1;

       return 1;

   }

   else if( (height - 100) * 0.9 > weight )

   {

       // 저체중

       WeightStatus = -1;

       return -1;

   }

   else

   {

       WeightStatus = 0;

       return 0;

   } 

}

int  standardWeight::getWeightStatus()

{

   return WeightStatus;

}

 

int main()

{

   standardWeight sw1;

   sw1.setHeight(170);

   sw1.setWeight(60);

   sw1.StdWeight();

   cout << sw1.getWeightStatus() << endl;

   return 0;

}

 

 

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

CPP 주말 과제 Time 클래스  (0) 2012.07.27
CPP ImaginaryNumber  (0) 2012.07.27
CPP 함수 실습과제  (0) 2012.07.25
CPP 함수 cvr, cba, cbv  (0) 2012.07.24
CPP 실습과제 0724 배열, 함수  (0) 2012.07.24

Java 채팅 코드

Programming/JAVA,JSP 2012. 7. 25. 17:59 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

'Programming > JAVA,JSP' 카테고리의 다른 글

JAVA TCP 통신 예제  (0) 2012.11.17
Java 계산기 레이아웃  (0) 2012.11.17
setLookAndFeel 예제  (0) 2012.11.04
JAVA Look and Feel 활용 사이트  (0) 2012.11.04
JAVA Applet Chatting Client  (0) 2012.07.26

CPP 함수 실습과제

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

1. 임의의 세 수를 키보드로 입력받아 분산을 구해 모니터로 출력하는 프로그램 작성

2. 아래 표를 배열 a로 하여 가로 합계, 세로 합계 및 총합계를 구하는 프로그램

-하나의 배열과 두 개의 변수만 선언

-for문 사용

-각 합계 출력

356

214

871

354

3. 이차방정식(y = ax2 + bx + c)의 세 계수(a, b, c)를 입력하면 해를 구해주는 프로그램

-예: 입력 시 : 1 0 -1 출력 시 : 1.000000 -1.000000

입력 시 : 1 2 1 출력 시 : -1.000000 -1.000000

4. 비행기 좌석 예약 프로그램

-요소 수가 10개인 구조체 배열 사용

-좌석 번호, 좌석 예약 표시, 예약자 성씨(last name), 예약자 이름(first name) 저장

-다음 메뉴 제공

원하는 작업에 해당하는 글자를 선택하시오.

a)비어 있는 좌석 수 표시

b)비어 있는 좌석 목록 표시

c)좌석 예약

d)예약 취소

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

CPP ImaginaryNumber  (0) 2012.07.27
CPP 표준체중 계산 프로그램  (0) 2012.07.26
CPP 함수 cvr, cba, cbv  (0) 2012.07.24
CPP 실습과제 0724 배열, 함수  (0) 2012.07.24
CPP 주민등록번호 분석기  (0) 2012.07.23

CPP 함수 cvr, cba, cbv

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

#include <iostream>

using namespace std;

 

void cbr(int& a);

void cba(int* a);

void cbv(int a);

int main()

{

   int i = 3;

   cbr(i);      cout << i << endl;

   cba(&i);  cout << i << endl;

   cbv(i);      cout << i << endl;

}

void cbr(int& a) // call by refrence

{  a++; }

void cba(int* a) // call by address

{  (*a)++; }

void cbv(int a)     // call by value

{  a++; }

 

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

CPP 표준체중 계산 프로그램  (0) 2012.07.26
CPP 함수 실습과제  (0) 2012.07.25
CPP 실습과제 0724 배열, 함수  (0) 2012.07.24
CPP 주민등록번호 분석기  (0) 2012.07.23
CPP Chapter 03 실습  (0) 2012.07.23

CPP 실습과제 0724 배열, 함수

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

#include <iostream>

using namespace std;

 

int TotalCalculation( int arr[] , int num );

 

int main()

{

 

   int  s1[6]={100, 90, 76, 89, 100, 88}, sum=0;

   int  s2[4]={100, 90, 76, 89};

   sum=TotalCalculation( s1, 6);  //반환값을 sum 변수에 할당!!!

   cout  << "총점 : " << sum << endl;

   sum=TotalCalculation( s2, 4);  //반환값을 sum 변수에 할당!!!

   cout  << "총점 : " << sum << endl;

}

int TotalCalculation( int arr[] , int num )

{      // arr 총점을 구할 점수 배열

       // num 총점을 구할 점수의 갯수

   // TODO: 이부분을 채워서 실행되도록 하시오.

}

 


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

CPP 함수 실습과제  (0) 2012.07.25
CPP 함수 cvr, cba, cbv  (0) 2012.07.24
CPP 주민등록번호 분석기  (0) 2012.07.23
CPP Chapter 03 실습  (0) 2012.07.23
CPP 0722 실습과제  (0) 2012.07.22