2017-09-10 2 views
0

Code:Fehlermeldung "Expression muss integral oder unscoped Enum haben Typ"

int a1, b1, c1, a2, b2, c2; 

    printf("This is the program to help you solve \n First Degree In Two Variable Equation \n"); 

    printf("The standard of \n First Degree In Two Variable Equation is follow: " 
     " \n a1 * x + b1 * y = c1\n a2 * x + b2 * y = c2 "); 

    printf("Please enter a1"); 
    scanf("%d", &a1); 

    printf("Please enter b1"); 
    scanf("%d", &b1); 

    printf("Please enter c1"); 
    scanf("%d", &c1); 

    printf("Please enter a2"); 
    scanf("%d", &a2); 

    printf("Please enter b2"); 
    scanf("%d", &b2); 

    printf("Please enter c2"); 
    scanf("%d", &c2); 
    if (a1 * b2 == a2 * b1) 
     printf("Coefficient's VALUE ARE NOT ALLOW please enter again"); 
    else 
    { 
     double x = (double)(b2 * c1 - b1 * c2)/(a1 * b2 - a2 * b1); 
     double y = (double)(a1 * c2 - a2 * c1)/(a1 * b2 - a2 * b1); 
     printf(" x = " + x + "\n y = " + y); 
    } 
    return 0; 
} 

versuchen, diese Codes auf Visual Studio setzen Sie am Ende der Code printf ("x =" + * sehen x * + "\ ny =" + y); Sie können das x sehen, das ich benutze *, um zu blockieren, zeigen Sie die Fehlermeldung Ausdruck muss integralen oder unscoped enum Typ haben! wie ich es beheben

+3

'printf (“ x = "+ x + "\ ny =" + y);' -> 'printf (" x =% f \ ny =% f \ n ", x, y);' – BLUEPIXY

+0

danke, dass du mir hilfst –

Antwort

1

try unten Code:

int a1, b1, c1, a2, b2, c2; 

printf("This is the program to help you solve \n First Degree In Two Variable Equation \n"); 

printf("The standard of \n First Degree In Two Variable Equation is followed: " 
    " \n a1 * x + b1 * y = c1\n a2 * x + b2 * y = c2 "); 

printf("Please enter a1"); 
scanf("%d", &a1); 

printf("Please enter b1"); 
scanf("%d", &b1); 

printf("Please enter c1"); 
scanf("%d", &c1); 

printf("Please enter a2"); 
scanf("%d", &a2); 

printf("Please enter b2"); 
scanf("%d", &b2); 

printf("Please enter c2"); 
scanf("%d", &c2); 
if (a1 * b2 == a2 * b1) 
    printf("Coefficient's VALUE ARE NOT ALLOW please enter again"); 
else 
{ 
    double x = (double)(b2 * c1 - b1 * c2)/(a1 * b2 - a2 * b1); 
    double y = (double)(a1 * c2 - a2 * c1)/(a1 * b2 - a2 * b1); 
    printf(" x = %f\ny = %f\n", x, y); 
} 
return 0; 
} 
Verwandte Themen