Skip to content

Commit

Permalink
Merge pull request #1 from git-user-cpp/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
git-user-cpp authored Feb 11, 2023
2 parents 41a9b03 + d3fea9f commit 6638d2d
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

use std::io;

fn main() {
//main menu
menu_main();
//mutable variable for main menu
let mut choise = String::new();

loop {
//main menu
menu_main();

//choosing an option
io::stdin()
.read_line(&mut choise)
.expect("Failed to read line");

//checks if it's a number
let choise: u8 = match choise.trim().parse() {
Ok(0) => break,
Ok(num) => num,
Err(_) => continue,
};
}
println!("{}", choise);
}

//main menu function
fn menu_main() {
println!(" -----------------------\n| Finance manager |\n -----------------------\n| Choose an option: |\n| [1] Insert products |\n| [2] Show percentage |\n -----------------------");
println!(" -----------------------\n| Finance manager |\n -----------------------\n| Choose an option: |\n| [1] Insert products |\n| [2] Show percentage |\n| [0] Exit |\n -----------------------\n");
}

0 comments on commit 6638d2d

Please sign in to comment.