debugging11.cpp.txt

来自「C++上机课的习题答案」· 文本 代码 · 共 40 行

TXT
40
字号
// Chapter 12 of C++ How to Program
// Debugging problem (debug.cpp)

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

#include "arithmetic.h"

template< class T >
void printResult( T num )
{
   cout << "The result of the operation is: "
        << num << endl;
}

int main() {
   Arithmetic < int > a( 5, 3 );
   Arithmetic< int > b( 7, 5 );

   cout << "Arithmetic performed on variable a:\n";
   printResult( a.add() );
   printResult( a.sub() );
   printResult( a.mult() );
   printResult( a.div() );

   cout << "\nArithmetic performed on variable b:\n";
   printResult( b.add() );
   printResult( b.sub() );
   printResult( b.mult() );
   printResult( b.div() );
   
   system("PAUSE");
   return 0;
}


⌨️ 快捷键说明

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