Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.File;
- import java.io.PrintWriter;
- import java.util.Scanner;
- public class Vaje5 {
- static void kodiraj(int kljuc, String vhod, String izhod)throws Exception{
- Scanner sc = new Scanner (new File(vhod));
- PrintWriter izhodna = new PrintWriter(izhod);
- char rezultat;
- while(sc.hasNextLine()){
- String vrstica = sc.nextLine();
- for (int i = 0; i < vrstica.length(); i++) {
- rezultat = (char)(vrstica.charAt(i)^ kljuc);
- izhodna.print(rezultat);
- }
- izhodna.println();
- }
- sc.close();
- izhodna.close();
- }
- public static void main(String[] args)throws Exception{
- //kodiraj(13, "C:/Users/ji4988/Desktop/vhod.txt", "C:/Users/ji4988/Desktop/izhod.txt");
- //kodiraj(13, "C:/Users/ji4988/Desktop/izhod.txt", "C:/Users/ji4988/Desktop/vhod.txt");
- }
- }
Add Comment
Please, Sign In to add comment