русский
Germany.ruForen → Архив Досок→ Programmierung

нужна помощь с++

10.12.12 21:24
Re: нужна помощь с++
 
Sweti lipmos местный житель
Sweti lipmos
in Antwort Simple 10.12.12 21:19, Zuletzt geändert 11.12.12 08:07 (Sweti lipmos)

#include "stdafx.h"
#include "ausgabe.h"
void printvector (double *vector, int laenge);
int lesenAuswertungspunkte (double *auswertungspunktex, double *auswertungspunktey);
int main(int argc, char* argv[])
{
double *Interpolationspunktex =NULL;
double *Interpolationspunktey=NULL;

int laenge = lesenAuswertungspunkte (Interpolationspunktex, Interpolationspunktey);
int lesenAuswertungspunkte (double *auswertungspunktex, double*auswertungspunktey)
{
char dateiname [100];
printf_s ("Welche Datei möchten Sie zum lesen von Interpolationspunkte öffnen? ");
sscanf_s ("%s",dateiname, strlen (dateiname));
int a;
FILE *fp=_fsopen(dateiname, "rt+",_SH_DENYRD);
if (fp!=NULL)
{
char Line [100];
if (fgets(Line, 100, fp)==NULL)
{
printf_s("Die Zeile in der Datei %s kann nicht geoeffnet werden", dateiname);
return 0;
}
if (sscanf_s(Line, "Anzahl %d", &a)!=1)
{
printf_s("Falsche Datei geoeffnet?");
return 0;
}
auswertungspunktex= new double [a];
auswertungspunktey= new double [a];
for (int i=0; i<=1; i++)
{
for (int j=0; j<=a; j++)
{
if (feof (fp)==0)
{
printf ("Fehler beim auslesen von x oder y");
return 0;
}
if (i==0)
fscanf_s(fp, "%f", auswertungspunktex [j]);
else fscanf_s (fp, "%f", auswertungspunktey [j]);
}
}
printf_s ("Ihre Interpolationspunkte x:");
printvector (auswertungspunktex, a);
printf_s ("Ihre Interpolationspunkte y:");
printvector (auswertungspunktey, a);
fclose (fp);
}
printf_s("diese Datei existiert nicht!");
return a;
}


Только не ругайтесь сильно, я начинающая!!

Слава богу, я атеист..
 

Sprung zu