Thema: c noob frage
Einzelnen Beitrag anzeigen
Alt 27.11.2003, 22:02   #1
porli
minderwertiges individuum
 
Registriert seit: 09.09.2002
Beiträge: 1.888


porli eine Nachricht über ICQ schicken
Standard c noob frage

also ich hab da es programm...

und da will ich wenn er 1 eingibt das unterprogramm für die berechnung der quadratischen aufrufen!
aba ich weiß nicht genau warums nicht geht es passiert genau gar nix, wenn ma eins drückt!

Code:
#include <stdio.h>
#include <conio.h>
#include <math.h>
float unterwurzfkt(float vara,float varb,float varc,float unterwurz);
float komplexeloesungen(float vara,float varb,float varc,float erg2);
float reelleloesungen(float vara,float varb,float varc,float ergreteil,float unterwurz);

void main ()
{
   float quadratische;
	int auswahl;
   printf("Bitte treffen sie ihre Auswahl: \n\n");
   printf("1) Quadratische Gleichung loesen\n");
   printf("2) Mittelwert berechnen\n");
   printf("3) Requesion\n");
   printf("Auswahl: ");
   scanf("%d",&auswahl);
   /*void clrscr(void);*/
   switch(auswahl)
     {
       case 1:
        {
          void quadratische();
          break;
	     }
       case 2:
        {
   		 printf("\nMittelwertberechnung: ");
   	  }
       case 3:
        {
   		 printf("\nRegession: ");
   		 break;
        }
     default:
   	 {
   	   printf("Falsche Auswahl!!");
   	   break;
       }
     }
   getch();

}
void quadratische()
{
   float vara,varb,varc,erg1,erg2,unterwurz,ergreteil;
   do
   {
     printf("a: ");
     scanf("%f",&vara);
     if (vara==0)
     {
       	printf("   a darf nicht 0 sein! Da es sonst keine Quadratische Gleichung ist\n");
     }
   }
   while (vara==0);
   printf("b: ");
   scanf("%f",&varb);
   printf("c: ");
   scanf("%f",&varc);
   erg1=((-varb)/(2*vara));
   unterwurz=unterwurzfkt(vara,varb,varc,unterwurz);
   if (unterwurz<0)
   {
      erg2=komplexeloesungen(vara,varb,varc,erg2);
      printf("\nErgebnis 1: %5.3f",erg1);
      printf(" +");
      printf("%5.3fj",erg2);
      printf("\nErgebnis 2: %5.3f",erg1);
      printf(" -");
      printf("%5.3fj",erg2);
      printf("\nDiese Gleichung hat 2 komplexe Loesungen!!");
   }
   else
   {
      if (unterwurz==0)
      {
      	printf("\nErgebnis: %5.3f",erg1);
         printf("\nDiese Gleichung hat nur 1 reelle Loesung!!");
      }
      else
      {
      	ergreteil=reelleloesungen(vara,varb,varc,ergreteil,unterwurz);
      	erg1=(-varb/2*vara)+ergreteil;
      	erg2=(-varb/2*vara)-ergreteil;
      	printf("\nErgebnis 1: %5.3f",erg1);
      	printf("\nErgebnis 2: %5.3f",erg2);
      }
   }


 }
float unterwurzfkt(float vara,float varb,float varc,float unterwurz)
{
   unterwurz=((varb*varb)-(4*vara*varc));
   return(unterwurz);
}
float komplexeloesungen(float vara,float varb,float varc,float erg2)
{
	erg2=sqrt((-1)*((varb*varb)-(4*vara*varc)));
   return(erg2);
}
float reelleloesungen(float vara,float varb,float varc,float ergreteil,float unterwurz)
{
	ergreteil=sqrt(unterwurz)/(2*vara);
   return(ergreteil);
}
____________________________________

http://www.againsttcpa.com
Don\'t let them take your rights!
porli ist offline   Mit Zitat antworten