Thread Vokabeltrainer (17 answers)
Opened by Futureflo at 2011-03-06 23:06

Futureflo
 2011-03-07 12:42
#146278 #146278
User since
2011-03-06
26 Artikel
BenutzerIn
[default_avatar]
War das so wie du es gedacht hattest?:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/perl

use strict;
use warnings;

open (LESEN, "Vokabeln.txt")||die "Die Datei konnte nicht gefunden werden";
      my $vokabeln=<LESEN>;
close (LESEN);

my @vokabeln_array = split (/:+/, $vokabeln);

open (LESEN, "Loesung.txt")||die "Die Datei konnte nicht gefunden werden";
      my $loesung=<LESEN>;
close (LESEN);

my @loesung_array = split (/:+/, $loesung);

my$anzahl_loesung= $#loesung_array;
my$anzahl_vokabeln= $#vokabeln_array;




my @alle_versuche;
my @alle_vokabeln;
my $durchgaenge=0;
my %schon_gefragt= ();

while ($durchgaenge<($anzahl_loesung+1)){
my$vokabel = $vokabeln_array[$zahl];
#$zahl=0+rand($anzahl_vokabeln);

if(exists ($schon_gefragt{my$vokabel}) )  {
next;
}
else {

print"Translate the word $vokabeln_array[$zahl]\n";
my $eingabe = <STDIN>;    chomp $eingabe;
push @alle_versuche, $eingabe;
push @alle_vokabeln, $vokabeln_array[$zahl];

if ($eingabe eq $loesung_array[$zahl])     {
print"The translation is correct!\n";
$schon_gefragt{vokabel} = 1;
$durchgaenge++;
}
else {
print"The translation is incorrect\n";
$schon_gefragt{vokabel} = 1;

print"Do you want to save the incorrect word and answer?\n";
print"(1)Yes              (2)No\n";
my $antwort=<STDIN>;    chomp$antwort;

if($antwort eq 1){

open(SCHREIB,">nichtgekonnte.txt");
     print SCHREIB ">>Wrong:\n";
     print SCHREIB join "\n", @alle_vokabeln;
     print SCHREIB "\n\n";
     print SCHREIB ">>Answer:\n";
     print SCHREIB join "\n", @alle_versuche;
close(SCHREIB);
$durchgaenge++;
}
else{
$durchgaenge++;
}
}
}
}


Weil so geht leider nichts mehr...
Da meint er dann auf einmal, dass ich alle $zahl mit my belgenen muss, aber auch wenn ich das mache kommt keine richtige Lösung sondern er verwendet mir das Wort eigentlich noch häufiger...

View full thread Vokabeltrainer