Click here to Skip to main content
15,896,153 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Spherical Math Book ? Pin
ricecake2-May-07 3:35
ricecake2-May-07 3:35 
GeneralRe: Continuity and the Future of Mathematics Pin
Rilhas24-May-07 12:05
Rilhas24-May-07 12:05 
GeneralRe: Continuity and the Future of Mathematics Pin
Rilhas25-May-07 1:20
Rilhas25-May-07 1:20 
QuestionCircular shifting Pin
CarpenterJim28-Apr-07 9:39
CarpenterJim28-Apr-07 9:39 
AnswerRe: Circular shifting Pin
Luc Pattyn28-Apr-07 10:33
sitebuilderLuc Pattyn28-Apr-07 10:33 
GeneralRe: Circular shifting Pin
Stephen Hewitt29-Apr-07 15:04
Stephen Hewitt29-Apr-07 15:04 
AnswerRe: Circular shifting Pin
Arun.Immanuel28-Apr-07 16:01
Arun.Immanuel28-Apr-07 16:01 
AnswerRe: Circular shifting Pin
Stephen Hewitt29-Apr-07 14:59
Stephen Hewitt29-Apr-07 14:59 
// CommandLine.cpp : Defines the entry point for the console application.
//

#include "StdAfx.h"
#include <iostream>
#include <algorithm> // for 'std::rotate' and 'std::copy'
#include <iterator> // for 'ostream_iterator'

int main()
{
using namespace std;

int numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int *pOnePastEnd = numbers + sizeof(numbers)/sizeof(numbers[0]);

cout << "Before rotate:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;

// Rotate left.
rotate(numbers, numbers+1, pOnePastEnd);

cout << "After rotate left:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;

// Rotate right.
rotate(numbers, pOnePastEnd-1, pOnePastEnd);

cout << "After rotate right:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;

return 0;
}


Steve
GeneralRe: Circular shifting Pin
CarpenterJim30-Apr-07 15:12
CarpenterJim30-Apr-07 15:12 
GeneralRe: Circular shifting Pin
Stephen Hewitt30-Apr-07 15:16
Stephen Hewitt30-Apr-07 15:16 
GeneralRe: Circular shifting Pin
CarpenterJim30-Apr-07 15:24
CarpenterJim30-Apr-07 15:24 
GeneralRe: Circular shifting Pin
Nathan Addy2-May-07 8:48
Nathan Addy2-May-07 8:48 
JokeStar Wars Pin
Joeinorange227-Apr-07 13:26
Joeinorange227-Apr-07 13:26 
QuestionGolden Ratio Pin
Joeinorange227-Apr-07 13:22
Joeinorange227-Apr-07 13:22 
AnswerRe: Golden Ratio Pin
Paul Conrad14-Jul-07 10:18
professionalPaul Conrad14-Jul-07 10:18 
QuestionRandom Numbers: Is there anything really random? Pin
Bulky Fellow27-Apr-07 0:13
Bulky Fellow27-Apr-07 0:13 
AnswerRe: Random Numbers: Is there anything really random? Pin
cp987627-Apr-07 2:08
cp987627-Apr-07 2:08 
AnswerRe: Random Numbers: Is there anything really random? Pin
Nathan Addy27-Apr-07 10:58
Nathan Addy27-Apr-07 10:58 
GeneralRe: Random Numbers: Is there anything really random? Pin
cp987627-Apr-07 15:55
cp987627-Apr-07 15:55 
GeneralRe: Random Numbers: Is there anything really random? Pin
Stephen Hewitt29-Apr-07 18:10
Stephen Hewitt29-Apr-07 18:10 
GeneralRe: Random Numbers: Is there anything really random? Pin
Bulky Fellow29-Apr-07 23:26
Bulky Fellow29-Apr-07 23:26 
GeneralRe: Random Numbers: Is there anything really random? Pin
cp987630-Apr-07 0:54
cp987630-Apr-07 0:54 
AnswerMy Random Info Pages Pin
PICguy30-Apr-07 18:55
PICguy30-Apr-07 18:55 
GeneralRe: My Random Info Pages Pin
cp987630-Apr-07 19:14
cp987630-Apr-07 19:14 
GeneralRe: My Random Info Pages Pin
PICguy30-Apr-07 19:29
PICguy30-Apr-07 19:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.