003
11.02.2005, 16:23 Uhr
enno-tyrant
Frag nicht!
|
das wäre der teil1 (lernmodus) -> ist natürlich ausbaufähig
Code: |
#include <iostream> #include <fstream> #include <string> using std::cout; using std::cin; using std::ifstream; using std::ofstream; using std::string; using std::endl;
int main() { // Buchstaben-Zähler int a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0, i=0, j=0, k=0, l=0, m=0, n=0, o=0, p=0, q=0; int r=0, s=0, t=0, u=0, v=0, w=0, x=0, y=0, z=0, ae=0, oe=0, ue=0, sz=0; ifstream datei; ofstream toLearn; string pfad, sprache, buffer; cout << "Geben Sie den Namen inkl, Pfad der Datei ein: "; cin >> pfad; cout << "Geben Sie die Sprache der Datei ein:"; cin >> sprache; datei.open(pfad.c_str()); if(!datei){cout << "Fehler beim \x99""ffnen der Datei" << endl;} while(!datei.eof()) { getline(datei,buffer); } datei.close(); datei.clear(); char puffer[buffer.size()]; for(unsigned int index=0;index<buffer.size();++index) { puffer[index] = buffer[index]; }; for(unsigned int index=0;index<buffer.size();++index) { if(puffer[index] == 'a' || puffer[i] == 'A'){a++;} else if(puffer[index] == 'b' || puffer[index] == 'B'){b++;} else if(puffer[index] == 'c' || puffer[index] == 'C'){c++;} else if(puffer[index] == 'd' || puffer[index] == 'D'){d++;} else if(puffer[index] == 'e' || puffer[index] == 'E'){e++;} else if(puffer[index] == 'f' || puffer[index] == 'F'){f++;} else if(puffer[index] == 'g' || puffer[index] == 'G'){g++;} else if(puffer[index] == 'h' || puffer[index] == 'H'){h++;} else if(puffer[index] == 'i' || puffer[index] == 'I'){i++;} else if(puffer[index] == 'j' || puffer[index] == 'J'){j++;} else if(puffer[index] == 'k' || puffer[index] == 'K'){k++;} else if(puffer[index] == 'l' || puffer[index] == 'L'){l++;} else if(puffer[index] == 'm' || puffer[index] == 'M'){m++;} else if(puffer[index] == 'n' || puffer[index] == 'N'){n++;} else if(puffer[index] == 'o' || puffer[index] == 'O'){o++;} else if(puffer[index] == 'p' || puffer[index] == 'P'){p++;} else if(puffer[index] == 'q' || puffer[index] == 'Q'){q++;} else if(puffer[index] == 'r' || puffer[index] == 'R'){r++;} else if(puffer[index] == 's' || puffer[index] == 'S'){s++;} else if(puffer[index] == 't' || puffer[index] == 'T'){t++;} else if(puffer[index] == 'u' || puffer[index] == 'U'){u++;} else if(puffer[index] == 'v' || puffer[index] == 'V'){v++;} else if(puffer[index] == 'w' || puffer[index] == 'W'){w++;} else if(puffer[index] == 'x' || puffer[index] == 'X'){x++;} else if(puffer[index] == 'y' || puffer[index] == 'Y'){y++;} else if(puffer[index] == 'z' || puffer[index] == 'Z'){z++;} else if(puffer[index] == '\x84' || puffer[index] == '\x8E'){ae++;} else if(puffer[index] == '\x94' || puffer[index] == '\x99'){oe++;} else if(puffer[index] == '\x81' || puffer[index] == '\x9A'){ue++;} else if(puffer[index] == '\xE1'){sz++;}; }; { toLearn.open(sprache.c_str()); toLearn << "a=" << a << endl; toLearn << "b=" << b << endl; toLearn << "c=" << c << endl; toLearn << "d=" << d << endl; toLearn << "e=" << e << endl; toLearn << "f=" << f << endl; toLearn << "g=" << g << endl; toLearn << "h=" << h << endl; toLearn << "i=" << i << endl; toLearn << "j=" << j << endl; toLearn << "k=" << k << endl; toLearn << "l=" << l << endl; toLearn << "m=" << m << endl; toLearn << "n=" << n << endl; toLearn << "o=" << o << endl; toLearn << "p=" << p << endl; toLearn << "q=" << q << endl; toLearn << "r=" << r << endl; toLearn << "s=" << s << endl; toLearn << "t=" << t << endl; toLearn << "u=" << u << endl; toLearn << "v=" << v << endl; toLearn << "w=" << w << endl; toLearn << "x=" << x << endl; toLearn << "y=" << y << endl; toLearn << "z=" << z << endl; toLearn << "ä=" << ae << endl; toLearn << "ö=" << oe << endl; toLearn << "ü=" << ue << endl; toLearn << "ß=" << sz << endl; toLearn.close(); toLearn.clear(); }; }
|
-- ...um etwas zu verstehen muß man wissen wie es funktioniert... |