mirror of
https://bitbucket.org/Mattrixwv/projecteulerrust.git
synced 2025-12-06 17:43:58 -05:00
Added problem 3
This commit is contained in:
16
src/main.rs
16
src/main.rs
@@ -1,3 +1,10 @@
|
||||
//ProjectEulerRust/src/main.rs
|
||||
//Matthew Ellison
|
||||
// Created: 06-11-20
|
||||
//Modified: 06-11-20
|
||||
//This is a driver function for the Project Euler solutions in Rust
|
||||
|
||||
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
@@ -9,7 +16,7 @@ mod Problems;
|
||||
#[derive(PartialEq)]
|
||||
enum Selections{EMPTY, SOLVE, DESCRIPTION, LIST, EXIT, SIZE}
|
||||
|
||||
static problemNumbers: [u32; 3] = [0, 1, 2];
|
||||
static problemNumbers: [u32; 4] = [0, 1, 2, 3];
|
||||
|
||||
fn main(){
|
||||
let mut selection = Selections::EMPTY;
|
||||
@@ -114,6 +121,10 @@ fn solveProblem(problemNumber: u32){
|
||||
println!("{}", Problems::Problem2::getDescription());
|
||||
println!("{}", Problems::Problem2::solve());
|
||||
}
|
||||
else if(problemNumber == 3){
|
||||
println!("{}", Problems::Problem3::getDescription());
|
||||
println!("{}", Problems::Problem3::solve());
|
||||
}
|
||||
}
|
||||
fn descriptionMenu(){
|
||||
//Give some extra space to print the description
|
||||
@@ -145,6 +156,9 @@ fn printDescription(problemNumber: u32){
|
||||
else if(problemNumber == 2){
|
||||
println!("{}", Problems::Problem2::getDescription());
|
||||
}
|
||||
else if(problemNumber == 3){
|
||||
println!("{}", Problems::Problem3::getDescription());
|
||||
}
|
||||
}
|
||||
fn getProblemNumber() -> u32{
|
||||
println!("Enter a problem number: ");
|
||||
|
||||
Reference in New Issue
Block a user