?
//Bankkonto.cpp : Definiert den Einstiegspunkt für die Konsolenanwendung.
//
#include "stdafx.h"
#include "STRING.H"
#include "stdlib.h"
FILE *datei;
int _tmain(int argc, _TCHAR* argv[])
{
char Passwort[50+1], nummer[50+1], Betrag[50+1], Input[50+1];
int A = 'A', j = 'j', B, C;
while (j == 'J' || j == 'j')
{
system("Cls");
system("color 4C");
strcpy (nummer, "123");
printf ("\n\tBankomat\b");
printf ("\n~~~~~~~~~~~~~~~~~~~\n");
printf ("Passwort: ");
scanf ("%s", Passwort);
if (strcmp(Passwort, nummer)==0 )
{
printf ("\n~~~~~~~~~~~~~~~~~~~\n");
fflush(stdin);
printf ("\nLogin erfolgreich\n");
printf ("\n~~~~~~~~~~~~~~~~~~~\n");
datei = fopen("C:\\Dokumente und Einstellungen\\mamar\\Desktop\\konten.txt", "a+");
fgets(Betrag, sizeof(Betrag), datei);
printf ("\nKonto enth\x84lt: %s", Betrag);
sscanf(Betrag,"%d",&B);
printf ("\n(1)Abheben oder (2)Einzahlen? ");
scanf ("%c", &A);
printf ("\n~~~~~~~~~~~~~~~~~~~\n");
printf ("\nBetrag Eingeben: ");
scanf ("%s", Input);
printf ("\n~~~~~~~~~~~~~~~~~~~\n");
sscanf(Input,"%d",&C);
if (A == '1')
{
printf ("\nKonto enh\x84lt neu: %d",B - C);
printf ("\n\n~~~~~~~~~~~~~~~~~~~\n");
fprintf(datei, "\n%d", B - C);
}
if (A == '2')
{
printf ("\nKonto enth\x84lt neu: %d", B + C);
printf ("\n~~~~~~~~~~~~~~~~~~~\n");
fprintf(datei, "\n%d", B + C);
}
}
else
{
printf ("\nERROR...\nSYSTEM FAILURE...\n");
}
printf ("\nNochmal (j/n)?");
fflush(stdin);
scanf ("%c", &j);
}
printf ("\n");
return 0;
}
bin jetzt soweit...habe aber noch ein problem..wenn ich den Betrag eingebe übernimmt es ihn mir zwar ind die datei zeigt ihn mir beim nächsten versuch jedoch nicht an...
ich will das ich einen betrag eingebn kann, es diesen speichert undbeim nächsten mal wieder ausgibt könnt ihr mir dabei helfen???
mfg anonymer