Advertisement
rootuss

ostatnia cyfra

Dec 8th, 2017
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdlib>
  4. #include <string>
  5. #include <conio.h>
  6.  
  7. using namespace std;
  8.  
  9. string imie, nazwisko;
  10. int nr_tel;
  11.  
  12. int main()
  13. {
  14.     fstream d,w;
  15.  
  16.     d.open("dane.txt",ios::in);
  17.     w.open("wyniki.txt",ios::out);
  18.  
  19.     if(d.good()==false)
  20.     {
  21.         cout<<"popsules cos moze utworz plik zal mi cie"<<endl;
  22.         exit(0);
  23.     }
  24.  
  25.     string l;
  26.     int i=0;
  27.  
  28.     while(getline(d,l)) {
  29.         i=l.length();
  30.         w<<l[i-1]<<endl;
  31.     }
  32.  
  33.  
  34.     d.close();
  35.     w.close();
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement