Added problem 3

This commit is contained in:
2020-06-13 16:28:07 -04:00
parent 58c966711d
commit 9c16d61a09
7 changed files with 141 additions and 5 deletions

View File

@@ -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: ");