Program That Seperates Even And Odds Error

Write your question here.
Hello everyone my program separates even and odd numbers from an input(vector). When i cout the vector nothing shows up.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// EvenOddSeperation.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
using namespace 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]);
	 }
}
You did not call your Seperate function in main()

Add this after line 19: Seperate(input);


P.S. For some reason I cannot answer you in your previous topic: http://www.cplusplus.com/forum/lounge/136258/
It still comes up blank.
Works for me and here: http://ideone.com/9z7fJP
What do you input? Is it just finishes without showing anything (int that case this: http://www.cplusplus.com/forum/beginner/1988/ might help), hangs or crashes?
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.
Oh exactly what happens is
1) I enter "1234567890"
2) It doesn't output anything and it just hangs at a blank screen
1) I enter "1234567890"
It is one number so...
2) It doesn't output anything and it just hangs at a blank screen
...it waits for 9 more.

To read 10 digits, you can do:
1
2
3
4
5
for(int x = 0; x < 10; ++x) {
    char y;
    std::cin >> y;
    input.push_back(y - '0');
}
http://ideone.com/WxXfDG
You really saved me. Thank you for all your help with this program i really appreciate it!! :) :) :)
Topic archived. No new replies allowed.