// EvenOddSeperation.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
usingnamespace std;
void Seperate (vector<int> & input);
int _tmain(int argc, _TCHAR* argv[])
{
vector<int> input;
cout<< "Enter the 10 numbers that you want to be seperated"<<endl;
for(int x=0;x<10;x++)
{
int y;
cin>> y;
input.push_back(y);
}
for(int y=0;y<10;y++)
{
cout<< input[y];
}
return 0;
}
void Seperate (vector<int> &input)
{
string newvec;
int size;
size=input.size();
int start=0;
int end=size;
while (true) {
while ((start != end) && (input[start] % 2 == 0)) {
++start;
} //This part gets the even numbers.
if (start == end--) break; //Checks if we are done.
while ((start != end) && (input[end] % 2 != 0)) {
--end;
}
if (start == end) break;//Checks if we are done.
swap(input[start++], input[end]);
}
}
I even put the code in the link that you gave me (ideone) and it did the same thing. I also put the cout<< "Press Enter To Continue" and the following code and it still does the same thing. Im using Visual Studio Ultimate 2012 if that helps because I'm sure its a compiler thing.