C 10

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: áµôåA+ Ù Ù A+ A+ –ÐBt ÐBt + Ð B t ÐBt + ·ª* ·ª* áµôåA+ áµôåA+ ù ù A A 10 C++ _ n ·ª* _n · + xn_ ·ª* –+ push_front() ( push_back() ( insert() x n _ · “ =” –( pop() ( erase() ( clear() ª – xn _·ª~ x n _· – ˜– ÇìA1 front() sn _ · ( back() ( ª~ ( ÐBt 11 C++ _ c ·ª* _c · O…Ø ˜ C Ç ´ —— ˜CÇ c_ Ð B t + ìA+ ìA+ ·ª* ·ª* Ø 10-1 2~N : c _ Ð…O´ª* Ð…O´ª* áµôåA+ ù ÐBt· ÐBt· A –+ ( ·ª N Øp 12 //10_1.cpp #include <iostream> #include <iomanip> #include <vector> // @ using namespace std ; int main() { vector<int> A(10); int n; int primecount = 0, i, j; cout<<"Enter a value>=2 as upper limit: "; cin >> n; A[primecount++] = 2; 13 for(i = 3; i < n; i++) { if (primecount == A.size()) A.resize(primecount + 10); if (i % 2 == 0) continue; j = 3; while (j <= i/2 && i % j != 0) j += 2; if (j > i/2) A[pri...
View Full Document

This note was uploaded on 10/26/2010 for the course CS 071122 taught by Professor Xuxiaohua during the Fall '07 term at Tsinghua University.

Ask a homework question - tutors are online