Alle Datentypen-> "nicht deklarierter Bezeichner"


  • Mod

    Stefan032 schrieb:

    Weiß jemand woran es liegt?

    Vermutlich an einem Fehler in deinem Code.



  • Das habe ich mir auch gedacht 😃 😉 .
    Finde aber keine weiteren Fehler...
    Hier noch mal der aktuelle Code:

    #include <stdio.h>
    #include <stdlib.h>
    #include <Windows.h>
    #include <conio.h>
    #include <string.h>
    
    struct kondensator
    {
    
    	char bestellnr[20];
    	double kapazitet;
    	float preis;
    	float spannung;
    };
    int main()
    {
    	struct kondensator a,b;
    	float maxsp=15,maxc=10;
    	float floata;
    	float tempca,tempcb;
    	int tempa,tempb;
    	float gesammt1,gesammt2;
    	int i=1,z=0;
    	char ch;
    
    	a.preis=0.0;
    	do
    	{
    		if(a.preis==0.0)      //prüfen ob mindestens 2. Sätze eingegeben wurde.
    		{
    	printf("Bitte Datensatz Nr.%i eingeben:\nBestellnr:",i);
    	scanf("%s",a.bestellnr);
    	fflush(stdin);
    	printf("\nC:\n");
    	scanf("%lf",&a.kapazitet);
    	fflush(stdin);
    	printf("\nPreis:\n");
    	scanf("%f",&a.preis);
    	fflush(stdin);
    	printf("\nSpannung:\n");
    	scanf("%f",&a.spannung);
    	fflush(stdin);
    	i++;
    		}
    		else
    		{
    
    	printf("Bitte Datensatz Nr.%i eingeben:\nBestellnr:",i);
    	scanf("%s",b.bestellnr);
    	fflush(stdin);
    	printf("\nC:\n");
    	scanf("%lf",&b.kapazitet);
    	fflush(stdin);
    	printf("\nPreis:\n");
    	scanf("%f",&b.preis);
    	fflush(stdin);
    	printf("\nSpannung:\n");
    	scanf("%f",&b.spannung);
    	fflush(stdin);
    	i++;
    	printf("Abbrechen?");
    	scanf("%c",&ch);
    	fflush(stdin);
    	if(ch!='\n')
    	{
    		z=1;
    	}
    		}
    
    		//Berechnung:
    
    	//1.	
    		floata=(maxsp/a.spannung)+0.5;
    		tempa=(int)floata;
    		tempca=(1/(tempa*(1/a.kapazitet)));
    		tempcb=(maxc/tempca)+0,5;
    		tempb=(int)tempcb;
    		gesammt1=tempa*tempb*a.preis;
    //2.
    
    		floata=(maxsp/b.spannung)+0.5;
    		tempa=(int)floata;
    		tempca=(1/(tempa*(1/b.kapazitet)));
    		tempcb=(maxc/tempca)+0,5;
    		tempb=(int)tempcb;
    		gesammt2=tempa*tempb*b.preis;
    
    		if(gesammt1>gesammt2)
    		{
    			strcpy(a.bestellnr,b.bestellnr);
    			a.kapazitet=b.kapazitet;
    			a.preis=b.preis;
    			a.spannung=b.spannung;
    		}
    
    	}while(!z);
    
            system("cls");
    
    	printf("Bestellnr:%s\nKapazität:%lf\nPreis:%f\nSpannung:%f",a.bestellnr,a.kapazitet,a.preis,a.spannung);
    
    	while(!_kbhit());
    	return 0;
    }
    


  • Kopier dir mal Zeile 105 nach Zeile 75 und 100. (und ruhig nochmal mit b )
    Und lass dir mal alle deine Kommentare ausgeben. z.B.:

    puts("//Berechnung:");
    

    Auch 1. und 2.


Anmelden zum Antworten