Addition program

When I output it gives me this:
What would you like to do?
1. Addition
2. Subtraction
3. Exit
1
Enter a 4 bit binary.
0 0 1 0
Enter another 4 bit binary.
1 1 0 1
0111-858993460
Press any key to continue . . .

I'm trying to use loops to create an addition program of two 4 bit binary's that the user enters and to output a 5 bit binary that compensates for overflow, hence the 5th bit. Please no recommendations on adding other libraries, I need to create it with these loops, but I've got no idea why I get this output. Help is appreciated. Thanks.
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "stdafx.h"
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
	int option;

	cout << "What would you like to do?\n";
	cout << "1. Addition\n";
	cout << "2. Subtraction\n";
	cout << "3. Exit\n";
	cin >> option;

	switch (option)
	{//beginning of whole switch
	
	case 1: //beginning of addition

		int rowA[4];
		int rowB[4];
		int rowC[5];
		int ca[4];


		cout << "Enter a 4 bit binary.\n";
		cin >> rowA[0] >> rowA[1] >> rowA[2] >> rowA[3];
		cout << "Enter another 4 bit binary.\n";
		cin >> rowB[0] >> rowB[1] >> rowB[2] >> rowB[3];

		int i = 0;
		ca[3] = 0;
		ca[2] = 0;
		ca[1] = 0;
		ca[0] = 0;

		for (i = 3; i >= 0; i--)
		{//beginning of addition for loop

			if (rowA[i] + rowB[i] + ca[i] <= 1)
			{
				rowC[i] = rowA[i] + rowB[i] + ca[i];
				if (i == 0)
				{
					rowC[i] = 0;
				}
				else ca[i - 1] = 0;
			}
			else if (rowA[i] + rowB[i] + ca[i] >= 2)
			{
				if (rowA[i] + rowB[i] >= 2)
				{
					rowC[i] = 0 + ca[i];
					if (i == 0)
					{
						rowC[i] = 1;
					}
					else ca[i - 1] = 1;
				}
				else if (rowA[i] + rowB[i] <= 1)
				{
					rowC[i] = 0;
					if (i == 0)
					{
						rowC[i] = 1;
					}
					else ca[i - 1] = 1;
				}
			}

		}//end of addition for loop

		cout << rowC[0] << rowC[1] << rowC[2] << rowC[3] << rowC[4] << endl;


	}//end of whole switch
	return 0;
}
Topic archived. No new replies allowed.