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

📄 ex10_14.cpp

📁 This rar contains code from every chapter of Wrox.Ivor.Hortons.Beginning.Visual.C.Plus.Plus.2008.Mar
💻 CPP
字号:
// Ex10_14.cpp
// Storing ref class objects in a double-ended queue

#include "Person.h"
#include <cliext/deque>
#include <cliext/algorithm>

using namespace System;
using namespace cliext;

int main(array<System::String ^> ^args)
{
  
  deque<Person>^ people = gcnew deque<Person>(); 
  
  String^ first;             // Stores a first name
  String^ second;            // Stores a second name
  Person person;             // Stores a Person

  while(true)
  {
    Console::Write(L"Enter a first name or press Enter to end: ");
    first = Console::ReadLine();
    if(first->Length == 0)
      break;
    Console::Write(L"Enter a second name: ");
    second = Console::ReadLine();
    person = Person(first->Trim(),second->Trim());
    people->push_back(person);
  }

  sort(people->begin(), people->end());

  // Output the contents of the vector
  Console::WriteLine(L"\nThe persons in the vector are:");
  for each(Person^ p in people)
    Console::WriteLine("{0}",p);
    
  return 0;
}

⌨️ 快捷键说明

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