게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
클래스 관련 질문입니다.
게시물ID : programmer_5931짧은주소 복사하기
작성자 : 더럽혀진우연
추천 : 0
조회수 : 395회
댓글수 : 6개
등록시간 : 2014/10/13 06:21:40
옵션
  • 베스트금지
  • 본인삭제금지
#include <iostream>
#include <string>
using namespace std;

class airplane {
private:
      int speed ;
   int name  ;
   int airline ;
   int route  ;
   int height ;
public:
 int getspeed();
 void setspeed(int s);
 int getroute();
 void setroute(int r);
 int getheight();
 void setheight(int h);
 void speedup();
 void speeddown();
 void init(int s, int r, int h);
 void show();
};
int airplane::getspeed(){
 return speed;
}
void airplane::setspeed(int s){
 speed = s;
}
int airplane::getroute(){
 return route;
}
void airplane::setroute(int r){
    route = r;
}
int airplane::getheight(){
 return height;
}
void airplane::setheight(int h){
 height = h;
}
void airplane::speedup(){
 speed += 4570;
}
void airplane::speeddown(){
 speed -= 9213;
}
void airplane::init(int s, int r, int h)
{
 speed = s;
 route = r;
 height = h;
}
void airplane::show(){
 cout << "=============== " << endl;
 cout << "속도: " << speed << endl;
 cout << "항로: " << route << endl;
 cout << "고도: " << height << endl;
 cout << "=============== " << endl;
}
int main()
{
 
    if(airplane1.getheight()>airplane2.getheight()<airplane3.getheight())
  cout << "airplane1가 고도가 높습니다" << endl;
 if(airplane1.getheight() <airplane2.getheight() > airplane3.getheight())
  cout << "airplane2가 고도가 높습니다" << endl;
if(airplane1.getheight() >airplane2.getheight() >airplane3.getheight())
     cout << "airplane3가 고도가 높습니다" << endl;
   
 if(airplane1.getspeed() > airplane2.getspeed() > airplane3.getspeed())
  cout << "airplane1가 가장 빠릅니다" << endl;
 if(airplane1.getspeed() < airplane2.getspeed() > airplane3.getspeed())
  cout << "airplane2가 가장 빠릅니다" << endl;
 if(airplane1.getspeed()> airplane2.getspeed() < airplane3.getspeed())
     cout << "airplane3가 가장 빠릅니다" << endl;
 return 0;
}
 
비행기를 만드는 클래스인데
 
조건이 다음과 같은데 어디서부터 해야할지 난감합니다.
 
도움좀 크게 주시는분께 제가 별다방 커피 하나 쏴드립니다..
 

1 .동적 생성 / 일반 생성을 이용해 airplane class의 인스턴스를
   3개이상 생성.
2 . 접근자 / 설정자를 사용해서
 ( 비행기 : 이름 , 항공사 , 고도 , 속도 , 항로 ) 를 설정
   각각의 값을 읽어오게 할것.
3 . 적절한 멤버 함수를 사용하여 비행기의 고도 속도 항로를
    변경할수 있게 멤버함수를 작성.
4 .  3개의 인스턴스(비행기)를 어느 비행기의 고도가
     제일 높은지 어느 비행기가 제일 빠른지 출력할수 있게
     메인 함수를 구할것. (?) 해결?
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호