Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Moin Moin. Hier mal mein Code:


#include <stdlib.h>

#include <string.h>


int main(int argc,char *argv[])

{

	//Variablendeklaration

	double y = 6009652.527;	//Y-Koordinate

	double x = 4502236.944;	//X-Koordinate

	int BN = 3181;			//Blattnummer

	int BNaktuell = 3181;	//Blattnummer zum rechnen

	int i = 0, j = 0;		//Laufvariablen

	//Variablendeklaration Ende


	printf("\n\tProgramm zum Berechnen der Koordinaten und in Dateien schreiben\n\n");


	for(i=1; i<=15; i++)

	{

		if(j==2)

		{

			y = y - 250;

		}

		if(j==4)

		{

			y = y + 250;

			j = 0;

			if(i%88!=0)

			{

				BNaktuell = BNaktuell + 6;

			};

		}

		j++;

		printf("Blattnummer: %i  Y: %7.2fl  X: %7.2fl\t%i\n",BNaktuell,y,x,i);

		if(i%88==0)

		{

			BNaktuell = BNaktuell + 781;	//nach 88 Nummern kommt erhöhung

			y = y - 500;

		}

		else

		{

			BNaktuell++;

		}

	};


	return 0;

}

Das ganze Ding soll einmal circa 33000 x und y Koordinaten ausrechnen, welche ich alle auf papier habe und nun versuche einen Algorithmus zu entwickeln. Das mit dem Algorithmus klappt schon recht gut. Nur die Anzeige der beiden Float-variablen klappt nicht so ganz.

Anstatt bei der Y: 6009652.527 anzuzeigen, zeigt er: 6009652.531 an.

Anstatt bei der X: 4502236.944 anzuzeigen, zeigt er: 4502236.941 an.

DAs ist natürlich nur die erste Ausgabe als Beispiel. Wollte jetzt mal fragenm ob ihr mir sagen könnt, wo der Fehler ist. Danke im voraus.

Gruß FiSiHRO

Anstatt bei der Y: 6009652.527 anzuzeigen, zeigt er: 6009652.531 an.

Anstatt bei der X: 4502236.944 anzuzeigen, zeigt er: 4502236.941 an.

Nein, er zeigt 6009652.53l und 4502236.94l. Zwei Nachkommastellen und ein kleines 'L'.

Den l-Prefix gibt es nicht für %f, daher wird der Buchstabe normal ausgegeben.

Funktioniert bestens.

Danke.

Gruß FiSiHRO

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.