This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[allow(dead_code)] | |
fn encrypt(plaintext: &str, key: usize){ | |
let plaintext = &plaintext.to_uppercase(); | |
let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
let mut cipher = String::from(""); | |
for each_char in plaintext.chars(){ | |
match alphabet.find(each_char) { | |
Some(index) => { | |
let char_index = (index + key) % 26; | |
let char_place = alphabet.chars().nth(char_index).unwrap(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
give(); | |
} | |
fn give(){ | |
let mut vec = Vec::new(); | |
vec.push(1); | |
vec.push(2); | |
take(vec); | |
vec.push(3); |
NewerOlder