Guest User

Untitled

a guest
Jul 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1.  
  2. import java.io.File;
  3. import java.io.PrintWriter;
  4. import java.util.Scanner;
  5.  
  6.  
  7.  
  8.  
  9. public class Vaje5 {
  10. static void kodiraj(int kljuc, String vhod, String izhod)throws Exception{
  11. Scanner sc = new Scanner (new File(vhod));
  12. PrintWriter izhodna = new PrintWriter(izhod);
  13. char rezultat;
  14. while(sc.hasNextLine()){
  15. String vrstica = sc.nextLine();
  16. for (int i = 0; i < vrstica.length(); i++) {
  17. rezultat = (char)(vrstica.charAt(i)^ kljuc);
  18. izhodna.print(rezultat);
  19.  
  20. }
  21. izhodna.println();
  22. }
  23.  
  24.  
  25. sc.close();
  26. izhodna.close();
  27.  
  28.  
  29. }
  30. public static void main(String[] args)throws Exception{
  31. //kodiraj(13, "C:/Users/ji4988/Desktop/vhod.txt", "C:/Users/ji4988/Desktop/izhod.txt");
  32. //kodiraj(13, "C:/Users/ji4988/Desktop/izhod.txt", "C:/Users/ji4988/Desktop/vhod.txt");
  33.  
  34. }
  35.  
  36. }
Add Comment
Please, Sign In to add comment