so, hab mich nu ein bisl schlauer gemacht
wollte nun also ein beispielprogramm schreibn, einfacher rechner.
c main.c
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int zahl1, zahl2, ergebnis, wahl;
printf("1. Zahl eingeben: ");
scanf("%d", &zahl1);
printf("2. Zahl eingeben: ");
scanf("%d", &zahl2);
printf("Was wollen sie durchführen?\n");
printf("(1) 1. Zahl - 2. Zahl");
printf("(2) 1. Zahl + 2. Zahl");
printf("(3) 1. Zahl * 2. Zahl");
printf("(4) 1. Zahl / 2. Zahl");
scanf("%d", &wahl);
if(wahl == 1){
ergebnis = subtraktion(zahl1, zahl2);}
if(wahl == 2){
ergebnis = addition(zahl1, zahl2);}
if(wahl == 3){
ergebnis = multi(zahl1, zahl2);}
if(wahl == 4){
ergebnis = division(zahl1, zahl2);}
printf("Ergebnis: %d ", ergebnis);
return 0;
}
subtraktion.c
int subtraktion(int x, int y)
{
x = x - y;
return x;
}
addition.c
int addition(int x, int y)
{
x = x + y;
return x;
}
multi.c
int mulit(int x, int y)
{
x = x * y;
return x;
}
division.c
int division(int x, int y)
{
x = x / y;
return x;
}
habs der einfachheit halber erstma nur mit ints gemacht
genauso stehts da drinne. dennoch kommt er übers kompilieren nich rüber. 0 Fehler zeigt er mir an, aber executen kann ers nich?!
als prog nutz ich dat kostenlose dev C++ von Bloodsheed