015 
            14.03.2007, 15:38 Uhr 
            Suba Esel 
            
             
            
             
             
             | 
          So, hier der Quellcode:
  main.cpp: 
   
  
  
    | C++: | 
   
  
    
      
  #include <iostream> #include <fstream> #include <cmath> #include "clrscr.hpp"
  using namespace std;
  inline bool isPrime(unsigned long long int n) {     if(n==2)         return 1;     if (n<2||n%2==0)         return 0;
      for (int i = 3; i*i <= n; i += 2)     {         if(n % i == 0)         {             return 0;         }     }     return 1; }
  int main() {     unsigned long long int anzahl;     cout << "Wieviele Primzahlen sollen gefiltert und gespeichert werden?" << endl;     cin >> anzahl;     cout << endl;
      int startzeit = time(0);
      ofstream out("Primzahlen.txt");
      out << anzahl << " Primzahlen \n\n";     int j = 2, alt = 0;
      out << "1:     2" << endl;
      for (int i = 3;j <= anzahl;i+=2)     {         if (isPrime(i))         {             if (alt != j * 100 / anzahl)             {                 clrscr();                 cout << j * 100 / anzahl << " %" << flush;                 alt = j * 100 / anzahl;             }             out << j << ":     " << i << endl;             ++j;         }     }     clrscr();     int endzeit = time(0);     cout << "Dauer: " << endzeit - startzeit << " Sekunde(n).\nDie Primzahlen sind in der Datei \"Primzahlen.txt\" gespeichert.";     out << "\nDauer: " << endzeit - startzeit << " Sekunde(n).";     out.close();     cin.sync();     cin.get(); } 
       
      
     | 
   
   
  
  clrscr.hpp: 
   
  
  
    | C++: | 
   
  
    
      
  #include <windows.h>
  void clrscr() {   COORD coordScreen = { 0, 0 };  // upper left corner   DWORD cCharsWritten;   DWORD dwConSize;   HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE);   CONSOLE_SCREEN_BUFFER_INFO  csbi;
    GetConsoleScreenBufferInfo(hCon, &csbi);   dwConSize = csbi.dwSize.X * csbi.dwSize.Y;   // fill with spaces   FillConsoleOutputCharacter(hCon, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);   GetConsoleScreenBufferInfo(hCon, &csbi);   FillConsoleOutputAttribute(hCon, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);   // cursor to upper left corner   SetConsoleCursorPosition(hCon, coordScreen); } 
       
      
     | 
   
   
  
 
  Wie gesagt: sowohl ich als auch der andre haben Code::Blocks mit mingw drauf, und als ich ihm den Quellcode geschickt hab, ging alles. Andererseits - kann das an ICQ liegen? Darüber hab ich das verschickt. -- Simon |