Thanks for the tips. I have gotten it to compile, and have changed all of the things you said. The piece of code that I pointed out is supposed to look for a 1 in that position, and if so it adds that number to an integer, and at the end it should equal the binary number as an integer. That is why str3 is set to have those numbers in it. I still have problems once I compile though, because somewhere my code is not doing the right math. I get an answer, but it is not what it should be. After the changes you suggested it looks like this.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int i, num1, num2, num3=0;
unsigned choice, string;
char str1[7], op, str2[8], str4[8];
int str3[8]={64,32,16,8,4,2,1};
do
{
system("clear");
printf("Enter an Operation?\n");
printf("Yes(1) or No(2)\n");
scanf("%u", &choice);
}while (choice < 1 || choice > 2);
{
switch(choice)
case 1:
{
printf("Enter two binary numbers seperated by an operator: ");
scanf("%7s%c%8s", str1, &op, str2);
for (i=0; i<=7; i++)
if(str1[i]=='1'); //This is where there is problems
num1=(num1+str3[i]); //Convert Binary into integer so i can do arithmetic
if(str1[i]=='0');
num1=(num1 + 0);
if (str2[i]=='1');
num2=(num2+str3[i]);
if(str2[i]=='0');
num2=(num2+0);
if (op=='+')
num3=(num1+num2); //do the arithmetic on the converted binary number
if(op=='-')
num3=(num1-num2);
if(op=='*')
num3=(num1*num2);
if(op=='/')
num3=(num1/num2);
for (i=0; i<=7; i++) //convert it back into binary
str4[i]=(num3 % 2);
system("clear");
printf("%s%c%s", str1, op, str2);
printf("\nequals %s", str4);
break;
case 2:
printf("goodbye");
while(choice !=2);
return 0;
}
}
}
It composes for me but the outcome is not even close to correct. I am only using the system() to clear the screen so that it will clean it up a little so that it is a little easier for the users to read.