Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
xingmarc committed Jun 25, 2018
0 parents commit b6540fa
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

/target
**/*.rs.bk
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "group-result"
version = "0.1.0"
authors = ["Xing <xingmarc@yeah.net>"]

[dependencies]
28 changes: 28 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

fn matches(member: [u8; 4]) -> [(u8, u8); 6]
{
let mut result: [(u8, u8); 6] = [(0, 0); 6];
let mut i = 0;
let mut j = 1;
let mut count = 0;

while i < 4 {
j = i + 1;
while j < 4 {
result[count] = (member[i], member[j]);
count = count + 1;
j = j + 1;
}
i = i + 1;
}

result
}

fn main() {
let a = [1,2,3,4];
let combinition = matches(a);
for (t1, t2) in &combinition {
println!("{} vs {}", t1, t2);
}
}

0 comments on commit b6540fa

Please sign in to comment.