Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #1

Merged
merged 2 commits into from
Feb 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}