Paste
Pasted as C by Tim Hartmann ( 14 years ago )
#include <stdlib.h>
#include <stdlib.h>
#include <ctype.h>
main ()
{
while(1)
{
char eingabe;
float x,y;
printf("\nF\x81r Hilfe H eingeben");
printf("\n\nw\x84hle eine Rechenoperation \n\n 1 Addition (+)"
"\n 2 Subtraktion (-)\n 3 Multiplikation (*)"
"\n 4 Division (/)\n\n");
printf("Bitte ein Rechenzeichen eingeben: \n\n");
do{
eingabe=getchar();
} while (isspace(eingabe));
switch(toupper(eingabe))
{ case '+':
printf("\ngib X ein: ");
scanf("\n%f",&x);
printf("\n%.0f + " , x);
scanf("%f",&y);
printf("\n\n%f + %f = %f\n\n\a\a" , x,y,x+y);
system("pause");
system("cls");
case '-':
printf("\ngib X ein: ");
scanf("%f",&x);
printf("\n%.0f - " , x);
scanf("%f",&y);
printf("\n\n%f - %f = %f\n\n\a\a" , x,y,x-y);
system("pause");
system("cls");
case '*':
printf("\ngib X ein: ");
scanf("%f",&x);
printf("\n%.0f x " , x);
scanf("%f",&y);
printf("\n\n%f x %f = %f\n\n\a\a" , x,y,x*y);
system("pause");
system("cls");
case '/':
printf("\ngib X ein: ");
scanf("%f",&x);
printf("\n%.0f / " , x);
scanf("%f",&y);
printf("\n\n%f / %f = %f\n\n\a\a" , x,y,x/y);
system("pause");
system("cls");
case 'H':
printf("\n\n real calc (c) by TimHartmann!"
"\n benutze die Rechenzeichen hinter der Operation"
"zur Auswahl"
"\n Um das programm zu beenden Tippe x\n\n");
system("pause");
system("cls");
case 'X':
exit(0);
default:
printf("ung\x81ltige Eingabe\n\n");
system("pause");
}
}
}
Revise this Paste