fojtasd

Untitled

Apr 5th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4.  
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10.     char input;
  11.     unsigned long long des_misto = 0;
  12.     ifstream myFile;
  13.     myFile.open("pi.txt");
  14.     if (myFile.is_open()) {
  15.         cout << "File has been detected." << endl;
  16.     }
  17.     else {
  18.         cout << "Inicializace selhala. Soubor nenalezen." << endl;
  19.         system("pause");
  20.         return 0;
  21.     }
  22.  
  23.     cout << "Ktere desetinne misto picka te zajima, gadzo?" << endl;
  24.     cin >> des_misto;
  25.     if (des_misto > 1000000){
  26.         cout << "V databazi je pi na presnost 1 000 000 desetinnych mist." << endl;
  27.         cout << "Ukoncuji program." << endl;
  28.         system("pause");
  29.         return 0;
  30.     }
  31.  
  32.    
  33.    
  34.     cout << "3,";
  35.     for (int i = 0; i < des_misto; i++){
  36.         myFile >> input;
  37.         cout << input;
  38.     }
  39.     myFile.close();
  40.     cout << endl;
  41.  
  42.  
  43.  
  44.  
  45.     system("pause");
  46.     return 1;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment