Техническая Спецификация для Microchip Technology SW006023-2N
![Microchip Technology](https://files.manualsbrain.com/attachments/cf42c3c895ef469f06d2e47e97fd98d738fcf5cf/common/fit/150/50/7340124dc8aa983aaf764094e2f06faab86f306c03111c5817f7e4e53fb2/brand_logo.gif)
MPLAB
®
XC32 C/C++ Compiler User’s Guide
DS51686E-page 52
2012 Microchip Technology Inc.
The following is a simple C++ program. Create the following program with any
plain-text editor and save it as ex2.cpp.
plain-text editor and save it as ex2.cpp.
/* ex2.cpp */
#include <xc.h> // __XC_UART
#include <plib.h> // SYSTEMConfigPerformance()
#include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <numeric>
using namespace std;
// Device-Specific Configuration-bit settings
#pragma config FPLLMUL=MUL_20, FPLLIDIV=DIV_2, FPLLODIV=DIV_1,
FWDTEN=OFF
#pragma config POSCMOD=HS, FNOSC=PRIPLL, FPBDIV=DIV_8
template <class T>
inline void print_elements (const T& coll, const char* optcstr="")
{
typename T::const_iterator pos;
std::cout << optcstr;
for (pos=coll.begin(); pos!=coll.end(); ++pos) {
std::cout << *pos << ' ';
}
std::cout << std::endl;
}
template <class T>
inline void insert_elements (T& coll, int first, int last)
{
for (int i=first; i<=last; ++i)
{
coll.insert(coll.end(),i);
}
}
int main(void) {
// Configure the target for max performance at 80 MHz.
SYSTEMConfigPerformance (80000000UL);
// Direct stdout to UART 1 for use with the simulator
__XC_UART = 1;
deque<int> coll;
insert_elements(coll,1,9);
insert_elements(coll,1,9);
print_elements(coll, "on entry: ");