Browse Source

kabrel

remotes/origin/develop
fdai7801 11 months ago
parent
commit
08832c5a8a
  1. 35
      src/main/c/BasicMode.c

35
src/main/c/BasicMode.c

@ -93,11 +93,42 @@ int main() {
do {
printf("which operation would you like to have?(+ for addition, - for subtraction,* for multiplication and r for return :");
scanf(" %c", &auswahl2);
switch (auswahl2) {
case '+':
printf("enter the first binary number: ");
scanf("%lld", &bin1);
printf("enter the second binary number: ");
scanf("%lld", &bin2);
result = addition(bin1, bin2);
printf("%lld+%d = %lld\n", bin1, bin2, result);
break;
case '-':
printf("enter the first binary number: ");
scanf("%lld", &bin1);
printf("enter the second binary number: ");
scanf("%lld", &bin2);
result = subtraction(bin1, bin2);
printf("%lld-%lld = %lld\n", bin1, bin2, result);
break;
case '*':
printf("enter the first binary number: ");
scanf("%lld", &bin1);
printf("enter the second binary number: ");
scanf("%lld", &bin2);
result = multiplication(bin1, bin2);
printf("%lld*%d = %lld\n", bin1, bin2, result);
break;
case 'R':
case 'r':
printf("return.\n");
break;
default:
printf("Invalid selection. Please enter again.\n");
}
} while (auswahl2 != 'R' && auswahl2 != 'r');
break;
@ -108,8 +139,8 @@ int main() {
default:
printf("Invalid selection. Please enter again.\n");
}
} while (auswahl1 != 'Q' && auswahl1 != 'q');
} while (auswahl1 != 'Q' && auswahl1 != 'q');
return 0;
}
Loading…
Cancel
Save