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

📄 product1.cpp

📁 C++ 这是国外计算机科学教材系列《big C++》书籍的源代码ch6
💻 CPP
字号:
/* 
   This program compiles but doesn't run. 
   See product2.cpp for the complete program.
*/

#include <iostream>
#include <string>

using namespace std;

class Product
{
public:
   Product();

   void read();

   bool is_better_than(Product b) const;
   void print() const;
private:
};

int main()
{  
   Product best;

   bool more = true;
   while (more)
   {  
      Product next;
      next.read();
      if (next.is_better_than(best)) best = next;

      cout << "More data? (y/n) ";
      string answer;
      getline(cin, answer);
      if (answer != "y") more = false;
   }

   cout << "The best value is ";
   best.print();

   return 0;
}

⌨️ 快捷键说明

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