📄 debugging10.cpp
字号:
// Chapter 10 of C++ How to Program
// Debugging Problem (debugging10.cpp)
#include <iostream>
using std::cout;
using std::endl;
using std::cin;
using std::string;
#include "animal.h"
#include "lion.h"
#include "dog.h"
void setHeightWeight( Animal * );
int main()
{
Dog dog1( 60, 120, "Fido" );
Lion lion1( 45, 300 );
setHeightWeight( &lion1 );
setHeightWeight( &dog1 );
system("PAUSE");
return 0;
} // end main
// function setHeightWeight definition
void setHeightWeight( Animal *a )
{
int height;
int weight;
a->print();
cout << "Enter a new height (using standard units): ";
cin >> height;
a->setHeight( height );
cout << "Enter a new weight (using standard units): ";
cin >> weight;
a->setWeight( weight );
height = a->getHeight();
weight = a->getWeight();
cout << "Here are the new height and weight values:\n"
<< height << endl
<< weight << endl << endl;
} // end function setHeightWeight
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -