⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transprt.cpp

📁 Since the field of object oriented programming is probably new to you, you will find that there is a
💻 CPP
字号:
                              // Chapter 7 - Program 3 - TRANSPRT.CPP
#include <iostream.h>
#include "vehicle.h"

int main()
{
vehicle car, motorcycle, truck, sedan;

   car.initialize(4, 3000.0);
   motorcycle.initialize(2, 900.0);
   truck.initialize(18, 45000.0);
   sedan.initialize(4, 3000.0);
   
   cout << "The car has " << car.get_wheels() << " wheels.\n";
   cout << "The truck has a loading of " << truck.wheel_loading()
                  << " pounds per wheel.\n";
   cout << "The motorcycle weighs " << motorcycle.get_weight() 
                  << " pounds.\n";
   cout << "The sedan weighs " << sedan.get_weight() 
                  << " pounds, and has " << sedan.get_wheels() 
                  << " wheels.\n";

   return 0;
}




// Result of execution
//
// The car has 4 wheels.
// The truck has a loading of 2500 pounds per wheel.
// The motorcycle weighs 900 pounds.
// The sedan weighs 3000 pounds, and has 4 wheels.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -