Einzelnen Beitrag anzeigen
Alt 21.10.2003, 22:14   #11
Biri
Hero
 
Registriert seit: 04.09.2001
Beiträge: 894


Standard

jetzt jammer net so viel herum !
debuggen bringt weit mehr wie jammern.

sind aber auch logische fehler im prog. - denke, so sollte es funktionieren (ob die formel stimmt, weiß ich net):

PHP-Code:
#include <iostream.h>
#include <math.h>

int main() 
{
    
char s;
    
double p=0q=0x1=0x2=0w=0;
    
bool E=0;

    do
    {
        
cout << endl << "Enter Coefficients by pressing e" << endl
        
cout << "To Compute enter c" << endl;
        
cout << "press x to exit" << endl;

        
cout << "Wahl:";
        
cin  >> s;

        switch(
s)
        {
            case 
'e':                 
                
cout << endl << "Wert fuer p:";
                
cin >> p;
                
cout << "Wert fuer q:";
                
cin >> q;
                break;

            case 
'c':                 
                
w=sqrt(pow((p/2), 2)-q);
                
x1=-p/2+w;
                
x2=-p/2-w;
                if(
p<=0)
                {
                    
cout << "x1=" << -<< "/2+i*" << w;
                    
cout << "x2=" << -<< "/2+i*" << w;
                }
                else
                    
cout << "x1=" << x1 << " and " << "x2=" << x2
                break;
                
            case 
'x':
                
E=1;
                break;
        } 
    } while (
!= 1);
    
    return 
0;

Biri ist offline   Mit Zitat antworten