Facebook
From Alex, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 244
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <fstream>
  4. #include <time.h>
  5. #include <stdlib.h>
  6.  
  7. using namespace std;
  8. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  9.  
  10. int Odczyt(){
  11.         int X1[147483647];
  12.         int Wynik=0;
  13.         int i=0;
  14.        
  15.         ifstream odczyt;
  16.         odczyt.open("dane.txt");
  17.         if(odczyt){
  18.                
  19.                 while(!odczyt.eof())
  20.                 {
  21.                         odczyt>>X1[i];
  22.                         i++;
  23.                 }      
  24.         }
  25.         return X1[];
  26. }
  27.  
  28. int Zapis()
  29. {
  30.         int w,p;
  31.         ofstream zapis ("Wynik.txt");
  32.                 if(zapis){
  33.        
  34.        
  35.         for(int i=0;i<=m;i++)
  36.         {
  37.                 a=rand() % 128;
  38.                 zapis <<a<<" ";
  39.         }
  40.         zapis.close(); 
  41. }
  42. else{
  43.        
  44.         cout<<"Nieudało się zapisac pliku";
  45. };
  46.         zapis<<w<<"^"<<p<<" = "<<Potega(w,p);
  47. }
  48.  
  49. int Potega(int wykl;int pods;)
  50. {
  51.        
  52.         if(wykl>0)
  53.         {
  54.                 Potega(wykl-1,pods)*pods;
  55.                
  56.                
  57.         }else{return 0; }
  58.         return wynik;
  59. }
  60.  
  61. int main(int argc, char** argv) {
  62.         int m=1000000;
  63.         int a;
  64.         char o;
  65.        
  66.         srand (time(NULL));
  67.         cout<<"Pliki"<<endl;
  68.        
  69.         //o=Odczyt();
  70.         Zapis();
  71.        
  72.         ofstream zapis ("txt.txt");
  73.  
  74.  
  75.        
  76.         cout<<o;
  77.        
  78.        
  79.        
  80.        
  81.         return 0;
  82. }